public bool UpdateUser([FromBody] User user) { db.Configuration.ProxyCreationEnabled = false; db.Entry(user).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); return(true); }
public IHttpActionResult PutMedal(int id, Medal medal) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != medal.Medal_ID) { return(BadRequest()); } db.Entry(medal).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!MedalExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutAge_Group(int id, Age_Group age_Group) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != age_Group.Age_ID) { return(BadRequest()); } db.Entry(age_Group).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Age_GroupExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutEventType(int id, EventType eventType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != eventType.EventType_ID) { return(BadRequest()); } db.Entry(eventType).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!EventTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutProgram(int id, Program program) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != program.Program_ID) { return(BadRequest()); } db.Entry(program).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ProgramExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutGender(int id, Gender gender) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != gender.Gender_ID) { return(BadRequest()); } db.Entry(gender).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!GenderExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PutBanned_Substance(int id, Banned_Substance banned_Substance) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != banned_Substance.Substance_ID) { return(BadRequest()); } db.Entry(banned_Substance).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Banned_SubstanceExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }