public async Task <IHttpActionResult> PutSchedule(ScheduleUpdateViewModel model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } try { var schedule = await _schedules.Find(model.Id); schedule.TimeStarted = model.TimeStarted; schedule.TimeFinished = model.TimeFinished; schedule.DayOfWeek = model.DayOfWeek; await _schedules.Update(schedule); } catch (DbUpdateConcurrencyException) { if (!_schedules.Exists(model.Id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }