public IHttpActionResult PutCausationType(int id, CausationType causationType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != causationType.Id) { return(BadRequest()); } db.Entry(causationType).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CausationTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetCausationType(int id) { CausationType causationType = db.CausationTypes.Find(id); if (causationType == null) { return(NotFound()); } return(Ok(causationType)); }
public IHttpActionResult PostCausationType(CausationType causationType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CausationTypes.Add(causationType); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = causationType.Id }, causationType)); }
public IHttpActionResult DeleteCausationType(int id) { CausationType causationType = db.CausationTypes.Find(id); if (causationType == null) { return(NotFound()); } db.CausationTypes.Remove(causationType); db.SaveChanges(); return(Ok(causationType)); }