public IHttpActionResult AddWorkTime(DayTimeModel model) { if (!ModelState.IsValid) { return(InternalServerError(new Exception("Invalid model state"))); } TimeSchedules newWorkTime; try { Users currentUser = GetUser(); newWorkTime = ScheduleService.AddWorkingInterval( currentUser.Id, model.GetUtcStartDay(), model.GetUtcStartTimeSpan(), model.GetUtcEndtDay(), model.GetUtcEndTimeSpan()); } catch (Exception ex) { return(InternalServerError(ex)); } return(Ok(newWorkTime)); }