public IActionResult CreateChef(Chef newchef) { if (ModelState.IsValid) { db.Add(newchef); db.SaveChanges(); return(RedirectToAction("Index", newchef)); } else { return(RedirectToAction("NewChef")); } }
public IActionResult AddChef(Chef NewChef) { if (!ModelState.IsValid) { return(View("NewChef")); } db.Chefs.Add(NewChef); db.SaveChanges(); return(RedirectToAction("ViewChef")); }
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")); }