public IActionResult Update(int PizzaID, Pizza updatedPizza) { if (_context.Pizza.Count(p => p.PizzaId == PizzaID) == 0) { return(NotFound()); } _context.Pizza.Attach(updatedPizza); _context.Entry(updatedPizza).State = Microsoft.EntityFrameworkCore.EntityState.Modified; _context.SaveChanges(); return(Ok(updatedPizza)); }
public IActionResult Update(int ToppingID, Topping updatedTopping) { if (_context.Topping.Count(t => t.ToppingId == ToppingID) == 0) { return(NotFound()); } _context.Topping.Attach(updatedTopping); _context.Entry(updatedTopping).State = EntityState.Modified; _context.SaveChanges(); return(Ok(updatedTopping)); }
public IActionResult Update(int CustomerID, Customer updatedCustomer) { if (_context.Customer.Count(c => c.CustomerId == CustomerID) == 0) { return(NotFound()); } _context.Customer.Attach(updatedCustomer); _context.Entry(updatedCustomer).State = EntityState.Modified; _context.SaveChanges(); return(Ok(updatedCustomer)); }