예제 #1
0
        public ActionResult Create(Room room)
        {
            if (ModelState.IsValid)
            {
                db.Rooms.Add(room);
                db.SaveChanges();
                return RedirectToAction("Index");
            }

            ViewBag.BuildingID = new SelectList(db.Buildings, "ID", "BuildingName", room.BuildingID);
            return View(room);
        }
예제 #2
0
 public ActionResult Edit(Room room)
 {
     if (ModelState.IsValid)
     {
         db.Entry(room).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     ViewBag.BuildingID = new SelectList(db.Buildings, "ID", "BuildingName", room.BuildingID);
     return View(room);
 }