public IHttpActionResult PostFacilitiesDescription(FacilitiesDescription facilitiesDescription) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.FacilitiesDescription.Add(facilitiesDescription); try { db.SaveChanges(); } catch (DbUpdateException) { if (FacilitiesDescriptionExists(facilitiesDescription.Id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = facilitiesDescription.Id }, facilitiesDescription)); }
public IHttpActionResult PutFacilitiesDescription(int id, FacilitiesDescription facilitiesDescription) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != facilitiesDescription.Id) { return(BadRequest()); } db.Entry(facilitiesDescription).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!FacilitiesDescriptionExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetFacilitiesDescription(int id) { FacilitiesDescription facilitiesDescription = db.FacilitiesDescription.Find(id); if (facilitiesDescription == null) { return(NotFound()); } return(Ok(facilitiesDescription)); }
public IHttpActionResult DeleteFacilitiesDescription(int id) { FacilitiesDescription facilitiesDescription = db.FacilitiesDescription.Find(id); if (facilitiesDescription == null) { return(NotFound()); } db.FacilitiesDescription.Remove(facilitiesDescription); db.SaveChanges(); return(Ok(facilitiesDescription)); }