Skip to content
Snippets Groups Projects
Commit 36c33ce9 authored by Oleg Semenov's avatar Oleg Semenov
Browse files

save fixed

parent 5f1be1ae
Branches master
No related tags found
No related merge requests found
......@@ -21,6 +21,7 @@ export class CreateGroupComponent implements OnInit {
selectedFaculty:FacultyDO;
newGroup: GroupDO;
errorMessage: string;
createdGroup: GroupDO;
constructor(private router: Router, private route: ActivatedRoute,private dataService: DataProviderService) {}
......@@ -68,10 +69,16 @@ export class CreateGroupComponent implements OnInit {
createGroup() {
let newID = this.modules.length + 1;
let moduleId = this.selectedModule.getId;
this.newGroup = new GroupDO(newID, '', '', moduleId);
let moduleId = this.selectedModule.id;
this.newGroup = new GroupDO();
this.newGroup.id = newID;
this.newGroup.date = '';
this.newGroup.status = '';
this.newGroup.modulid = moduleId;
this.dataService.createGroupData(this.newGroup).then((group) => {
this.router.navigateByUrl('http://localhost:8080/groups/new', {state: {group: this.newGroup}});
this.createdGroup = group.payload;
this.router.navigateByUrl('http://localhost:8080/groups/new', {state: {group: this.createdGroup}});
}, (error) => {
if(error.type === ResponseType.CONNECTION_PROBLEM) {
this.errorMessage = 'Connection Problem';
......
......@@ -4,12 +4,4 @@ export class GroupDO {
status: string;
date: string;
modulid: number;
constructor(private iD: number, private statuS: string,
private datE: string, private moduleId: number) {
this.id = iD;
this.modulid = moduleId;
this.status = statuS;
this.date = datE;
}
}
......@@ -33,10 +33,10 @@ public class GroupManagementController {
@PostMapping("/groups/new")
public Learninggroup save(@RequestBody Learninggroup group){
groupRepository.save(group); {
group.setDatum(LocalDate.now());
group.setStatus("open");
}
groupRepository.save(group);
group.setDatum(LocalDate.now());
group.setStatus("open");
return group;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment