public async Task <IActionResult> Edit(int id, [Bind("Id,Text,Price,Active,Order,Type,Day,MenuCardId")] Menu menu) { if (id != menu.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(menu); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MenuExists(menu.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["MenuCardId"] = new SelectList(_context.MenuCards, "Id", "Id", menu.MenuCardId); return(View(menu)); }
public async Task <IActionResult> Edit(Menu menu) { if (ModelState.IsValid) { _context.Update(menu); await _context.SaveChangesAsync(); return(RedirectToAction("Index")); } ViewData["MenuCardId"] = new SelectList(_context.MenuCards, "Id", "MenuCard", menu.MenuCardId); return(View(menu)); }