// PUT: api/RemoveInventory/5 public void Put([FromBody] RemoveInventory inventories) { var findCables = db.Inventories.Where(i => i.ItemName == "Cable").SingleOrDefault(); var findConnecters = db.Inventories.Where(i => i.ItemName == "Connector").SingleOrDefault(); var findHeatshrink = db.Inventories.Where(i => i.ItemName == "HeatShrink").SingleOrDefault(); findCables.Quantity = findCables.Quantity - inventories.CableQuantity; findConnecters.Quantity = findConnecters.Quantity - inventories.ConnecterQuantity; findHeatshrink.Quantity = findHeatshrink.Quantity - inventories.HeatShrinkQuantity; db.SubmitChanges(); }
// POST: api/Inventory public void Post([FromBody] Inventory inventory) { db.Inventories.InsertOnSubmit(inventory); db.SubmitChanges(); }