public async Task <IActionResult> Edit(int id, [Bind("OrderId,DrinkId,CustomerName,DrinkName")] 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["DrinkId"] = new SelectList(_context.Drink, "DrinkId", "DrinkName", order.DrinkId); return(View(order)); }
public async Task <IActionResult> Edit(int id, [Bind("DrinkId,DrinkName,DrinkPrice")] Drink drink) { if (id != drink.DrinkId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(drink); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DrinkExists(drink.DrinkId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(drink)); }