public IActionResult NewDish() { NewDishWrapper DishWrapper = new NewDishWrapper(); DishWrapper.AllChefs = db.Chefs .Include(F => F.CreatedDishes) .ToList(); return(View("NewDish", DishWrapper)); }
public IActionResult AddDish(NewDishWrapper NewDishWrapper) { if (ModelState.IsValid == false) { NewDishWrapper DishWrapper = new NewDishWrapper(); DishWrapper.AllChefs = db.Chefs .ToList(); return(View("NewDish", DishWrapper)); } db.Dishes.Add(NewDishWrapper.Form); db.SaveChanges(); return(RedirectToAction("ViewDish")); }