/// <summary> /// Changes status of schedule and each reservation in that schedule to canceled /// </summary> /// <param name="scheduleId">Id of schedule</param> /// <returns></returns> public async Task ChangeSchedulesStatusToCanceled(int scheduleId) { var schedule = await _scheduleDataService.Get(scheduleId); schedule.Status = ScheduleStatus.Canceled; foreach (var reservation in schedule.Reservations) { if (reservation.Patient == null) { await _reservationDataService.Delete(reservation.Id); } else { reservation.Status = ReservationStatus.Canceled; } } schedule.Reservations.RemoveWhere(x => x.Patient == null); await _scheduleDataService.Update(schedule.Id, schedule); }
public async Task <bool> Delete(Reservation reservation) { return(await _reservationDataService.Delete(reservation.Id)); }