public IHttpActionResult UpdateUnavailablePeriod(int id, DateTimeModel model) { if (!ModelState.IsValid) { return(InternalServerError(new Exception("Invalid model state"))); } BusySchedules updatedWorkTime; try { Users currentUser = GetUser(); updatedWorkTime = ScheduleService.UpdateBusyInterval( currentUser.Id, id, model.GetStartDateTime(), model.GetEndDateTime()); } catch (Exception ex) { return(InternalServerError(ex)); } return(Ok(updatedWorkTime)); }
public IHttpActionResult GetUnvailablePeriods(int userId, [FromUri] DateTimeModel model) { if (!ModelState.IsValid) { return(InternalServerError(new Exception("Invalid model state"))); } List <BusySchedules> existingUnvailablePeriods; try { existingUnvailablePeriods = ScheduleService.GetAllBusyIntervalsPerPeriod( userId, model.GetStartDateTime(), model.GetEndDateTime()); } catch (Exception ex) { return(InternalServerError(ex)); } return(Ok(existingUnvailablePeriods)); }
public IHttpActionResult AddUnavailablePeriod(DateTimeModel model) { if (!ModelState.IsValid) { return(InternalServerError(new Exception("Invalid model state"))); } BusySchedules newUnavailablePeriod; try { Users currentUser = GetUser(); newUnavailablePeriod = ScheduleService.AddBusyInterval( currentUser.Id, model.GetStartDateTime(), model.GetEndDateTime()); } catch (Exception ex) { return(InternalServerError(ex)); } return(Ok(newUnavailablePeriod)); }