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