public IHttpActionResult UpdateDepartEventTime([FromUri] int event_fk) { try { DepartPlan earliestTime = db.DepartPlans.Where(a => a.event_fk == event_fk).OrderBy(a => a.time).FirstOrDefault(); db.Events.Find(event_fk).time = earliestTime.time; db.SaveChanges(); return(Ok("{}")); } catch (Exception ex) { Exception rootEx = ex.GetBaseException(); return(Content(HttpStatusCode.InternalServerError, rootEx.Message)); throw; } }
public IHttpActionResult UpdateDepartPlan([FromBody] DepartPlanDTO line) { try { DepartPlan line_to_update = db.DepartPlans.Find(line.event_fk, line.hotel_fk); line_to_update.time = line.time; db.SaveChanges(); return(Ok(line)); } catch (Exception ex) { Exception rootEx = ex.GetBaseException(); return(Content(HttpStatusCode.InternalServerError, rootEx.Message)); throw; } }