Fix creation and update.

This commit is contained in:
Alexis Lahouze 2017-07-22 14:29:29 +02:00
parent e927736b45
commit 3326dac51a
2 changed files with 6 additions and 3 deletions

View File

@ -17,6 +17,7 @@ export class ScheduleController{
private $stateParams,
private toastrService: ToastrService,
private scheduleService: ScheduleService,
private logger: Logger,
private $modal
) {
// Load operations on controller initialization.
@ -51,9 +52,11 @@ export class ScheduleController{
let subscription: Observable<Schedule>;
if(operation.id) {
subscription = this.scheduleService.create(operation);
} else {
this.logger.log("updating schedule", operation);
subscription = this.scheduleService.update(operation);
} else {
this.logger.log("creating schedule", operation);
subscription = this.scheduleService.create(operation);
}
return subscription.subscribe((operation: Schedule) => {

View File

@ -44,6 +44,6 @@ export class ScheduleService {
}
delete(schedule: Schedule): Observable<Schedule> {
return this.one(schedule.id).delete();
return this.one(schedule.id).remove();
}
}