// GET: HotelDetails public ActionResult AddRoomCategory() { HotelRoomCategoryViewModel category = new HotelRoomCategoryViewModel(); //category.HotelRoomCategoryId = (int)TempData["HotelRoomCategoryId"]; List <RoomCategory> roomCategory = hotelDetails.GetCategory(); List <SelectListItem> categoryList = new List <SelectListItem>(); foreach (RoomCategory detail in roomCategory) { categoryList.Add(new SelectListItem { Text = @detail.RoomType, Value = @detail.RoomId.ToString() }); } ViewBag.List = categoryList; return(View()); }