public ActionResult RefreshRetailers(string filter, int pageNumber) { if (!string.IsNullOrEmpty(filter)) { //verify zip code List <RetailModel> listRetailers = new List <RetailModel>(); var model = new WhereToBuyModel(); if (isFilterByZipCode(filter)) { model.RetailList = RetailManager.GetByZipCode(this.Session, filter, false, pageNumber, PAGE_SIZE); model.SearchByDesc = "Zip Code"; } else if (isFilterByCityAndState(filter)) { var splitString = filter.Split(','); string city = splitString[0]; string state = splitString[1]; model.RetailList = RetailManager.GetByCityAndState(this.Session, city, state, false, pageNumber, PAGE_SIZE); } model.SearchByValue = filter; return(PartialView(PathFromView("Partials/WhereToBuy/_DealersPartial"), model)); } return(new EmptyResult()); }
public ActionResult SearchRetailers(string filter) { if (!string.IsNullOrEmpty(filter)) { //verify zip code int pageNum = 1; List <RetailModel> listRetailers = new List <RetailModel>(); var model = new WhereToBuyModel(); if (isFilterByZipCode(filter)) { model.RetailList = RetailManager.GetByZipCode(this.Session, filter, false, pageNum, PAGE_SIZE); model.DiamondList = RetailManager.GetByZipCode(this.Session, filter, true, pageNum, DIAMOND_PAGE_SIZE); model.SearchByDesc = "Zip Code"; } else { var locator = new GeoLocator(filter); Task.Run(() => locator.Locate()).Wait(); string city = locator.City; string state = locator.State; model.RetailList = RetailManager.GetByCityAndState(this.Session, city, state, false, pageNum, PAGE_SIZE); model.DiamondList = RetailManager.GetByCityAndState(this.Session, city, state, true, pageNum, DIAMOND_PAGE_SIZE); } model.SearchByValue = filter; return(RenderMultipleViews(new List <RenderViewInfo>() { new RenderViewInfo() { ViewName = "retailersView", ViewPath = "~/Views/Partials/WhereToBuy/_DealersPartial.cshtml", Model = model }, new RenderViewInfo() { ViewName = "diamondsView", ViewPath = "~/Views/Partials/WhereToBuy/_DiamondDealersPartial.cshtml", Model = model } })); } return(new EmptyResult()); }
public ActionResult Index() { this.FillSeoInformation("Where To Buy"); ViewBag.Scripts = new List <string>() { "where_to_buy.js" }; var model = new WhereToBuyModel(); model.Countries = CountryManager.GetCountries(); model.AllRetailList = RetailManager.GetByBrand(this.CurrentBrand); if (model.AllRetailList.Retailers != null) { //sort random model.AllRetailList.Retailers = model.AllRetailList.Retailers.OrderBy(x => Guid.NewGuid()).Take(12).ToList(); } ViewBag.HasGoogleMaps = true; return(View(PathFromView("WhereToBuy"), model)); }