public async Task <IActionResult> Edit(int id, [Bind("OrderID,IsPlaced,IsPrepared,IsPaid,TableID")] 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))); } ViewData["TableID"] = new SelectList(_context.Tables, "TableID", "TableID", order.TableID); return(View(order)); }
public async Task <IActionResult> Edit(int id, [Bind("MenuItemID,Title,Description,Price,DiscountPrice,Category,IsAvailable,IsSpecialty,Image")] MenuItem menuItem) { if (id != menuItem.MenuItemID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(menuItem); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MenuItemExists(menuItem.MenuItemID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(menuItem)); }