public async Task <IActionResult> Edit(string id, [Bind("ID,ItemName,ItemEntered,Quantity")] Item item) { if (id != item.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(item); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ItemExists(item.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(item)); }
public async Task <IActionResult> Edit(int id, [Bind("OrderID,ItemName")] Order order) { if (id != order.OrderID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(order); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderExists(order.OrderID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(order)); }