public async Task <ActionResult <Order> > EditOrder(int id, [Bind("Id, UserId, OrderItems, Total")] Order order) { order.Id = id; if (ModelState.IsValid) { try { _context.Update(order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(id)) { return(NotFound()); } else { throw; } } } return(order); }
public async Task <ActionResult <Product> > EditProduct(int id, [Bind("Id,Title,Description,Price")] Product product) { product.Id = id; if (ModelState.IsValid) { try { _context.Update(product); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProductExists(id)) { return(NotFound()); } else { throw; } } } return(product); }