Esempio n. 1
0
        public IActionResult NewDish()
        {
            NewDishWrapper DishWrapper = new NewDishWrapper();

            DishWrapper.AllChefs = db.Chefs
                                   .Include(F => F.CreatedDishes)

                                   .ToList();
            return(View("NewDish", DishWrapper));
        }
Esempio n. 2
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"));
        }