public IActionResult Delete(int id) { Store_Inventory delete = _context.store_inventory.Where(c => c.store_id == id).FirstOrDefault(); _context.store_inventory.Remove(delete); _context.SaveChanges(); return(Ok(delete)); }
public IActionResult Post([FromBody] Store_Inventory inventory) { if (inventory == null) { return(NotFound()); } _context.store_inventory.Add(inventory); _context.SaveChanges(); return(Ok(inventory)); }
public ActionResult GetById(int id) { Store_Inventory store = _context.store_inventory.Where(c => c.store_id == id).FirstOrDefault(); if (store == null) { return(NotFound()); } return(Ok(store)); }
public IActionResult Put(int id, [FromBody] Store_Inventory inventory) { Store_Inventory delete = _context.store_inventory.Where(c => c.store_id == id).FirstOrDefault(); if (inventory == null || delete == null) { return(NotFound()); } _context.store_inventory.Remove(delete); _context.store_inventory.Add(inventory); _context.SaveChanges(); return(Ok(inventory)); }