public IHttpActionResult PutLobDescription(int id, LobDescription lobDescription) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != lobDescription.ID) { return(BadRequest()); } db.Entry(lobDescription).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!LobDescriptionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetLobDescription(int id) { LobDescription lobDescription = db.LobDescriptions.Find(id); if (lobDescription == null) { return(NotFound()); } return(Ok(lobDescription)); }
public IHttpActionResult PostLobDescription(LobDescription lobDescription) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.LobDescriptions.Add(lobDescription); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = lobDescription.ID }, lobDescription)); }
public IHttpActionResult DeleteLobDescription(int id) { LobDescription lobDescription = db.LobDescriptions.Find(id); if (lobDescription == null) { return(NotFound()); } db.LobDescriptions.Remove(lobDescription); db.SaveChanges(); return(Ok(lobDescription)); }