public ActionResult Create(RestaurantLocation restaurantlocation) { if (ModelState.IsValid) { db.RestaurantLocations.Add(restaurantlocation); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RestaurantId = new SelectList(db.Restaurants, "RestaurantId", "Name", restaurantlocation.RestaurantId); return View(restaurantlocation); }
public ActionResult Edit(RestaurantLocation restaurantlocation) { if (ModelState.IsValid) { db.Entry(restaurantlocation).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.RestaurantId = new SelectList(db.Restaurants, "RestaurantId", "Name", restaurantlocation.RestaurantId); return View(restaurantlocation); }