public IActionResult CreateChef(Chef NewChef) { Console.WriteLine("Hitting Create New Chef"); if (ModelState.IsValid) { Console.WriteLine("NewChef data is valid"); dbContext.Add(NewChef); dbContext.SaveChanges(); return(RedirectToAction("Chefs")); } return(View("NewChef")); }
public IActionResult NewDish(Dish newDish) { if (ModelState.IsValid) { newDish.CreatedAt = DateTime.Now; newDish.UpdatedAt = DateTime.Now; dbContext.Add(newDish); dbContext.SaveChanges(); return(RedirectToAction("dishes")); } else { return(View("newDish")); } }