public async Task <IActionResult> Create([Bind("Id,Name")] Menu menu) { if (ModelState.IsValid) { _context.Add(menu); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(menu)); }
public async Task <IActionResult> Create([Bind("Id,MenuId,SectionId,Name,Description,Price")] Menuitem menuitem) { if (ModelState.IsValid) { _context.Add(menuitem); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["MenuId"] = new SelectList(_context.Menu, "Id", "Id", menuitem.MenuId); ViewData["SectionId"] = new SelectList(_context.Section, "Id", "Id", menuitem.SectionId); return(View(menuitem)); }