public IActionResult AddDish(Dish newDish) { if (ModelState.IsValid) { db.Add(newDish); db.SaveChanges(); return(RedirectToAction("Index")); } else { return(View("Create")); } }
public IActionResult CreateDish(Dishes Dishes) { if (ModelState.IsValid) { dbContext.Add(Dishes); dbContext.SaveChanges(); return(RedirectToAction("Index")); } else { return(View("ShowAddNewDish")); }; }
public IActionResult Create(Dish NewDish) { Console.WriteLine("Hitting Create"); if (ModelState.IsValid) { Console.WriteLine("New Dish is Valid"); dbContext.Add(NewDish); dbContext.SaveChanges(); return(RedirectToAction("Index")); } else { Console.WriteLine("New Dish had errors"); return(View("New")); } }
public IActionResult CreateDish(Dish newDish) { db.Add(newDish); db.SaveChanges(); return(RedirectToAction("Index")); }