예제 #1
0
        public IActionResult NewDish()
        {
            DishWrapper vmod = new DishWrapper();

            vmod.FormModel = new Dish();
            vmod.AllChefs  = dbContext.Chefs.ToList();
            return(View(vmod));
        }
예제 #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));
            }
        }