public ActionResult Edit(Restaurant restaurant) { if (ModelState.IsValid) { db.Entry(restaurant).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(restaurant); }
public ActionResult Create(Restaurant restaurant) { if (ModelState.IsValid) { restaurant.Id = Guid.NewGuid(); db.Restaurants.Add(restaurant); db.SaveChanges(); return RedirectToAction("Index"); } return View(restaurant); }