public IHttpActionResult PostHoliday(HolidayViewModel holiday) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.UpdateHoliday(holiday.MapTo <Holiday>()); return(Ok(holiday)); }
public IHttpActionResult PutHoliday(int id, HolidayViewModel holiday) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != holiday.Id) { return(BadRequest()); } db.UpdateHoliday(holiday.MapTo <Holiday>()); return(StatusCode(HttpStatusCode.NoContent)); }