コード例 #1
0
        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);
        }
コード例 #2
0
 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);
 }