public async Task <IActionResult> Create([Bind("ID,Name")] DrinkCategory drinkCategory) { if (ModelState.IsValid) { _context.Add(drinkCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(drinkCategory)); }
public async Task <IActionResult> Create([Bind("MenuID,DrinkID")] DrinkMenu drinkMenu) { if (ModelState.IsValid) { _context.Add(drinkMenu); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["DrinkID"] = new SelectList(_context.Drinks, "Id", "Id", drinkMenu.DrinkID); ViewData["MenuID"] = new SelectList(_context.Menus, "ID", "ID", drinkMenu.MenuID); return(View(drinkMenu)); }