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); }
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); }