public IActionResult NewDish() { DishWrapper vmod = new DishWrapper(); vmod.FormModel = new Dish(); vmod.AllChefs = dbContext.Chefs.ToList(); return(View(vmod)); }
public IActionResult AddDish(DishWrapper fromForm) { if (ModelState.IsValid) { System.Console.WriteLine("***************************************************"); dbContext.Dishes.Add(fromForm.FormModel); dbContext.SaveChanges(); return(RedirectToAction("Dishes")); } else { fromForm.AllChefs = dbContext.Chefs.ToList(); return(View("NewDish", fromForm)); } }