public async Task <IActionResult> Edit(int id, [Bind("UserID,ID,OrderTime")] OrderStatus orderStatus) { if (id != orderStatus.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(orderStatus); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!OrderStatusExists(orderStatus.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["UserID"] = new SelectList(_context.User, "ID", "Email", orderStatus.UserID); return(View(orderStatus)); }
public async Task <IActionResult> Edit(int id, [Bind("OrderStatusID,ID,Quantity,ItemPrice,TotalPrice,Comment,MenuID")] MenuOrder menuOrder) { if (id != menuOrder.ID) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(menuOrder); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MenuOrderExists(menuOrder.ID)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MenuID"] = new SelectList(_context.Menu, "ID", "Description", menuOrder.MenuID); ViewData["OrderStatusID"] = new SelectList(_context.OrderStatus, "ID", "ID", menuOrder.OrderStatusID); return(View(menuOrder)); }