//[OutputCache(Duration = 600, VaryByParam = "id")] public ActionResult City(string id, ShoppingCart cart, BrowseHistory bh) { ViewBag.bagitems = GetCartItems(cart); ViewBag.delivery = bh.IsDelivery; string ct = string.IsNullOrEmpty(id) ? string.Empty : DecodeString(id); CityModel cm = new CityModel(); cm.CityName = ct; cm.YelpTops = new List <TopYelpModel>(); if ((HttpContext.Cache["CityTops_" + id] != null)) { cm.YelpTops = (List <TopYelpModel>)HttpContext.Cache["CityTops_" + id]; } else { List <BizInfo> lbi = BizInfoRepository.GetBizInfoByCity(ct, true); YelpReviewModel yrm = new YelpReviewModel(); foreach (var b in lbi) { yrm = YelpBizDetails.GetYelpBiz(b); if (string.IsNullOrEmpty(b.YelpBizId) == false) { cm.YelpTops.Add(new TopYelpModel() { Biz = b, Yelp = yrm }); } } cm.YelpTops = cm.YelpTops.OrderByDescending(e => e.Yelp.Biz.rating).Take(3).ToList(); HttpContext.Cache.Insert("CityTops_" + id, cm.YelpTops); } //cm.BizInfos = BizInfoRepository.GetTopnTopRatedBizInfosInCity(3, ct, true); cm.NewBiz = BizInfoRepository.GetLastnNewBizInfosByCity(4, ct, true); StringBuilder sb = new StringBuilder(); sb.Append("["); foreach (var b in cm.YelpTops) { sb.Append("["); sb.Append("'" + b.Biz.BizTitle + "',"); sb.Append("'" + b.Biz.Address.AddressLine + "',"); sb.Append("'" + b.Biz.Address.City + "',"); sb.Append("'" + b.Biz.Address.State + "',"); sb.Append("'" + b.Biz.Address.ZipCode + "',"); sb.Append("'" + b.Biz.Latitude + "',"); sb.Append("'" + b.Biz.Longitude + "',"); sb.Append("'" + b.Biz.BizInfoId + "',"); sb.Append("'" + b.Biz.ImageUrl + "'],"); } if (cm.YelpTops.Count > 0) { sb.Remove(sb.Length - 1, 1); } sb.Append("]"); cm.MapMarkers = sb.ToString(); cm.BizInfo = BizInfoRepository.GetBizInfoByCity(ct, true).FirstOrDefault(); cm.ShowCuisines = AllCuisinesView.ShowCuisinesView_Bootatrap(BizCuisineRepository.GetBizCuisinesByCity(true, ct), ct, null); cm.ShowZipcodes = AllZopCodesView.ShowZipCodesView_Bootstarp(BizInfoRepository.GetBizInfoByCity(ct, true), ct, null); cm.CuisinesInCity = BizInfoRepository.GetCuisinesInCity(ct); cm.ZipsInCity = BizInfoRepository.GetZipsInCity(ct); return(View(cm)); }