public IHttpActionResult PostJusProcedure(JusProcedure jusProcedure) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.JusProcedures.Add(jusProcedure); try { db.SaveChanges(); } catch (DbUpdateException) { if (JusProcedureExists(jusProcedure.ProcedureID)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = jusProcedure.ProcedureID }, jusProcedure)); }
public IHttpActionResult PutJusProcedure(int id, JusProcedure jusProcedure) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != jusProcedure.ProcedureID) { return(BadRequest()); } db.Entry(jusProcedure).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!JusProcedureExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetJusProcedure(int id) { JusProcedure jusProcedure = db.JusProcedures.Find(id); if (jusProcedure == null) { return(NotFound()); } return(Ok(jusProcedure)); }
public IHttpActionResult DeleteJusProcedure(int id) { JusProcedure jusProcedure = db.JusProcedures.Find(id); if (jusProcedure == null) { return(NotFound()); } db.JusProcedures.Remove(jusProcedure); db.SaveChanges(); return(Ok(jusProcedure)); }