public IHttpActionResult PutAppConfig(long id, AppConfig appConfig) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != appConfig.AppConfigId) { return(BadRequest()); } db.Entry(appConfig).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!AppConfigExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutUserAttendance(long id, UserAttendance userAttendance) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != userAttendance.UserID) { return(BadRequest()); } db.Entry(userAttendance).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!UserAttendanceExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutSession(long id, Session session) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != session.SessionId) { return(BadRequest()); } db.Entry(session).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!SessionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }