public async Task <ActionResult> SearchPager(StayBazar.Areas.Admin.Models.StaticHtmlPageModel data) { StayBazar.Areas.Admin.Models.StaticHtmlPageModel data1 = new StayBazar.Areas.Admin.Models.StaticHtmlPageModel(); SearchResults result = await SearchFilter(data); List <CLayer.SearchResult> dtlist2 = BLayer.Property.GetStaticPagePrpty(data.PageId); data1.PropertyAdd = dtlist2; data1.PropertyList = result.Results; data1.IsSearched = true; data1.SearchString = data.SearchString; data1.MaxCount = result.TotalRows; data1.CurrentPage = data.CurrentPage; return(View("~/Areas/Admin/Views/PropertyAdd/SearchList.cshtml", data1)); }
public async Task <ActionResult> Search(StayBazar.Areas.Admin.Models.StaticHtmlPageModel data) { //sumbit from the home page or from side box StayBazar.Models.SearchResultModel md = new StayBazar.Models.SearchResultModel(); if (data.CurrentPage < 1) { data.CurrentPage = 1; } SearchResults result = await SearchFilter(data); List <CLayer.SearchResult> dtlist2 = BLayer.Property.GetStaticPagePrpty(data.PageId); data.PropertyAdd = dtlist2; data.PropertyList = result.Results; data.MaxCount = result.TotalRows; data.IsSearched = true; md.Results = result.Results; md.CurrentPageIndex = data.CurrentPage; md.MaxCount = result.TotalRows; md.IsSearched = true; md.Destination = data.Destination; return(View("~/Areas/Admin/Views/PropertyAdd/Index.cshtml", data)); }
private async Task <SearchResults> SearchFilter(StayBazar.Areas.Admin.Models.StaticHtmlPageModel data) { SearchResults searchr = new SearchResults(); CLayer.SearchCriteria cr = new CLayer.SearchCriteria(); //int temp; cr.Adults = 0; cr.Children = 0; cr.StayType = 0; cr.Bedrooms = 0; int totalCount = 0; cr.Destination = data.Destination; if (cr.Destination != null && cr.Destination != "") { cr.Destination = cr.Destination.Replace("'", "").Replace(";", "").Replace("\"", ""); } cr.CheckOut = DateTime.Today.AddDays(2); cr.CheckIn = DateTime.Today.AddDays(1); cr.Lattitude = 0; cr.Longitude = 0; cr.Bedrooms = 0; cr.RangeBudgetMax = 0; cr.RangeBudgetMin = 0; cr.DistanceInKm = 0; cr.Features = ""; cr.StarRatingRange = 0; string loc = ""; if (data.Location != null && data.Location != "") { loc = data.Location; if (cr.Destination != null && cr.Destination != "") { loc = BLayer.City.GetLocation(loc); if (loc == "") { loc = BLayer.City.GetLocation(data.Destination); //if (loc == "") ... //loc = data.Location + ", " + loc; } } } else { loc = BLayer.City.GetLocation(data.Destination); } if (loc == "") { cr.Lattitude = 0; cr.Longitude = 0; } else { Common.Utils.Location pos; pos = await Common.Utils.GetLocation(loc); cr.Lattitude = pos.Lattitude; cr.Longitude = pos.Longitude; } int rip = 0; int.TryParse(System.Configuration.ConfigurationManager.AppSettings.Get(Common.Utils.SERARCH_MAX_ROWS), out rip); cr.NoOfRows = rip; cr.Features = ""; int sr = data.CurrentPage - 1; if (sr < 0) { sr = 0; } sr = sr * cr.NoOfRows; cr.StaringRow = sr; cr.SortOrder = (CLayer.SearchCriteria.SortBy.PriceAsc); cr.Location = data.Location; if (cr.Location != null && cr.Location != "") { cr.Location = cr.Location.Replace("'", "").Replace(";", "").Replace("\"", ""); } cr.UserType = CLayer.Role.Roles.Customer; cr.LoggedInUser = 0; //data.PropertyList = await FillLocations(BLayer.Property.SearchWithFilter(out totalCount, cr)); //data.TotalRows = totalCount; searchr.Results = await FillLocations(BLayer.Property.SearchWithFilter(out totalCount, cr)); searchr.TotalRows = totalCount; return(searchr); }