public IHttpActionResult PutTreatment_Product(int id, Treatment_Product treatment_Product) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != treatment_Product.TreatmentProductID) { return(BadRequest()); } db.Entry(treatment_Product).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Treatment_ProductExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetTreatment_Product(int id) { Treatment_Product treatment_Product = db.Treatment_Products.Find(id); if (treatment_Product == null) { return(NotFound()); } return(Ok(treatment_Product)); }
public IHttpActionResult PostTreatment_Product(Treatment_Product treatment_Product) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.Treatment_Products.Add(treatment_Product); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = treatment_Product.TreatmentProductID }, treatment_Product)); }
public IHttpActionResult DeleteTreatment_Product(int id) { Treatment_Product treatment_Product = db.Treatment_Products.Find(id); if (treatment_Product == null) { return(NotFound()); } db.Treatment_Products.Remove(treatment_Product); db.SaveChanges(); return(Ok(treatment_Product)); }