public IHttpActionResult PutBoughtDrugSuply(int id, BoughtDrugSuply boughtDrugSuply) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != boughtDrugSuply.Id) { return(BadRequest()); } db.Entry(boughtDrugSuply).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BoughtDrugSuplyExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetBoughtDrugSuply(int id) { BoughtDrugSuply boughtDrugSuply = db.BoughtDrugSuplySet.Find(id); if (boughtDrugSuply == null) { return(NotFound()); } return(Ok(boughtDrugSuply)); }
public IHttpActionResult PostBoughtDrugSuply(BoughtDrugSuply boughtDrugSuply) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.DrugSuplySet.Add(boughtDrugSuply); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = boughtDrugSuply.Id }, boughtDrugSuply)); }
public IHttpActionResult DeleteBoughtDrugSuply(int id) { BoughtDrugSuply boughtDrugSuply = db.BoughtDrugSuplySet.Find(id); if (boughtDrugSuply == null) { return(NotFound()); } db.DrugSuplySet.Remove(boughtDrugSuply); db.SaveChanges(); return(Ok(boughtDrugSuply)); }