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