Exemplo n.º 1
0
        public IActionResult NewDish()
        {
            DishWrapper vmod = new DishWrapper();

            vmod.FormModel = new Dish();
            vmod.AllChefs  = dbContext.Chefs.ToList();
            return(View(vmod));
        }
Exemplo n.º 2
0
        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));
            }
        }