public IHttpActionResult PostCurrentStatu(CurrentStatu currentStatu) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.CurrentStatus.Add(currentStatu); try { db.SaveChanges(); } catch (DbUpdateException) { if (CurrentStatuExists(currentStatu.CurrentStatus)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = currentStatu.CurrentStatus }, currentStatu)); }
public IHttpActionResult PutCurrentStatu(string id, CurrentStatu currentStatu) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != currentStatu.CurrentStatus) { return(BadRequest()); } db.Entry(currentStatu).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CurrentStatuExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetCurrentStatu(string id) { CurrentStatu currentStatu = db.CurrentStatus.Find(id); if (currentStatu == null) { return(NotFound()); } return(Ok(currentStatu)); }
public IHttpActionResult DeleteCurrentStatu(string id) { CurrentStatu currentStatu = db.CurrentStatus.Find(id); if (currentStatu == null) { return(NotFound()); } db.CurrentStatus.Remove(currentStatu); db.SaveChanges(); return(Ok(currentStatu)); }