public ActionResult Index(RoomFilter filter) { var roomTypeList = Business.RoomService.GetRoomTypeList().Select(x => new SelectListItem { Text = x.Name, Value = x.RoomTypeId.ToString() }).ToList(); roomTypeList.Insert(0, new SelectListItem { Text = "-- All --", Value = "" }); ViewBag.RoomTypeList = roomTypeList; var districtList = Business.DistrictService.GetDistricts().Select(x => new SelectListItem { Text = x.DistrictName_EN, Value = x.DistrictCode.ToString() }).ToList(); districtList.Insert(0, new SelectListItem { Text = "-- All --", Value = "" }); ViewBag.Districts = districtList; return View(); }
public ActionResult SearchRoom(RoomFilter filter) { int totalRecords; var list = Business.RoomService.ListRoom(filter.Area, filter.Money, filter.RoomType, filter.District, filter.PageIndex, filter.PageSize, out totalRecords); ViewBag.ListImage = Business.RoomService.GetListImageRoom(list.Select(x => x.RoomId).ToArray()); var data = new SearchResult<Room>(filter) { TotalRecords = totalRecords, List = list }; return PartialView("_RoomList", data); }