public ActionResult Create(Restaurant restaurant)
 {
     _db.Restaurants.Add(restaurant);
     _db.SaveChanges();
     return(RedirectToAction("Index"));
 }
示例#2
0
 public ActionResult Create(Cuisine cuisine)
 {
     _db.Cuisines.Add(cuisine);
     _db.SaveChanges();
     return(RedirectToAction("Index")); // Instead of the View method, RedirectToAction allows you to trigger another route. In this case, we are triggering the index route.
 }