public ActionResult Create(Restaurant restaurant) { if (ModelState.IsValid) { restaurant.UserId = (int)Session["userID"]; db.Restaurants.Add(restaurant); db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CuisineId = new SelectList(db.Cuisines, "CusineId", "CuisineName", restaurant.CuisineId); return View(restaurant); }
public ActionResult Edit(Restaurant restaurant) { if (ModelState.IsValid) { db.Entry(restaurant).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CuisineId = new SelectList(db.Cuisines, "CusineId", "CuisineName", restaurant.CuisineId); return View(restaurant); }