public ActionResult AddRoomCategory(HotelRoomCategoryViewModel hotelRoomCategory) { List <RoomCategory> list = hotelDetails.GetCategory(); List <SelectListItem> categoryList = new List <SelectListItem>(); foreach (RoomCategory details in list) { categoryList.Add(new SelectListItem { Text = @details.RoomType, Value = @details.RoomId.ToString() }); } if (ModelState.IsValid) { HotelRoomBind hotel = AutoMapper.Mapper.Map <HotelRoomCategoryViewModel, HotelRoomBind>(hotelRoomCategory); hotelDetails.AddRoomCategoryForHotel(hotel); return(RedirectToAction("ManageHotel", "Admin")); } //ViewBag.RoomCategory = new SelectList(HotelRepository.GetCategories(), "RoomId", "RoomType"); return(View()); }