public ActionResult AddRooms() { InfrastructureHelper helper = new InfrastructureHelper(); ViewBag.hostelBlocks = new SelectList(helper.GetHostelBlocks(), "blockNumber", "blockNumber"); ViewBag.roomTypes = new SelectList(helper.GetRoomTypes(), "id", "val"); return(View()); }
public ActionResult AddRooms(Room userInput) { InfrastructureHelper helper = new InfrastructureHelper(); ViewBag.hostelBlocks = new SelectList(helper.GetHostelBlocks(), "blockNumber", "blockNumber"); ViewBag.roomTypes = new SelectList(helper.GetRoomTypes(), "id", "val"); if (!ModelState.IsValid) { return(View(userInput)); } helper.AddRoom(userInput); return(View()); }