Esempio n. 1
0
        public ActionResult ShowAllCuisines()
        {
            BizInfoModel bim = new BizInfoModel();
            // bim.ShowCities = AllCitiesView.ShowAllCities(BizInfoRepository.GetAllBizInfos(true), 4);
            List <BizCuisine> lbc = BizCuisineRepository.GetAllBizCuisines(true);

            bim.ShowCuisines = AllCuisinesView.ShowCuisinesView_Bootatrap(lbc, null, null);
            return(PartialView(bim));
        }
Esempio n. 2
0
        public ActionResult Index(ShoppingCart cart, BrowseHistory bh)
        {
            ViewBag.bagitems = GetCartItems(cart);
            ViewBag.delivery = bh.IsDelivery;
            BizInfoModel bim = new BizInfoModel();
            // bim.ShowCities = AllCitiesView.ShowAllCities(BizInfoRepository.GetAllBizInfos(true), 4);
            List <BizCuisine> lbc = BizCuisineRepository.GetAllBizCuisines(true);

            bim.ShowCuisines = AllCuisinesView.ShowCuisinesView_Bootatrap(lbc, null, null);
            bim.AllCuisines  = BizCuisineRepository.GetAllCuisines(true);
            return(View(bim));
        }
Esempio n. 3
0
        public ActionResult Index(string city, string zip, ShoppingCart cart, BrowseHistory bh)
        {
            if (string.IsNullOrEmpty(city) && string.IsNullOrEmpty(zip))
            {
                return(RedirectToAction("Index", "AllCities"));
            }

            ViewBag.delivery = bh.IsDelivery;
            BizInfoModel bim = new BizInfoModel();
            string       ct  = string.IsNullOrEmpty(city)?string.Empty : DecodeString(city);

            bim.CityName = ct;
            bim.ZipCode  = zip;
            bim.BizInfos = BizInfoRepository.GetBizInfoByZip(zip, true);
            bim.YelpTops = new List <TopYelpModel>();
            if ((HttpContext.Cache["CityZip" + ct + zip] != null))
            {
                bim.YelpTops = (List <TopYelpModel>)HttpContext.Cache["CityZip" + ct + zip];
            }
            else
            {
                YelpReviewModel yrm = new YelpReviewModel();
                foreach (var b in bim.BizInfos)
                {
                    yrm = YelpBizDetails.GetYelpBiz(b);
                    if (string.IsNullOrEmpty(b.YelpBizId) == false)
                    {
                        bim.YelpTops.Add(new TopYelpModel()
                        {
                            Biz = b, Yelp = yrm
                        });
                    }
                }
                bim.YelpTops = bim.YelpTops.OrderByDescending(e => e.Yelp.Biz.rating).Take(3).ToList();
                HttpContext.Cache.Insert("CityZip" + ct + zip, bim.YelpTops);
            }
            // bim.TopRatedBizInfos = BizInfoRepository.GetTopnTopRatedBizInfosInzip(3, zip, true);
            bim.BizInfo      = bim.BizInfos.FirstOrDefault();
            bim.NewBiz       = BizInfoRepository.GetLastnNewBizInfosByZip(4, zip, true);
            bim.ShowCuisines = AllCuisinesView.ShowCuisinesView_Bootatrap(BizCuisineRepository.GetBizCuisinesByZip(true, zip), ct, zip);
            StringBuilder sb = new StringBuilder();

            sb.Append("[");
            foreach (var b in bim.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 (bim.YelpTops.Count > 0)
            {
                sb.Remove(sb.Length - 1, 1);
            }
            sb.Append("]");
            bim.MapMarkers    = sb.ToString();
            bim.CuisinesInZip = BizInfoRepository.GetCuisinesInZip(zip);
            ViewBag.bagitems  = GetCartItems(cart);
            return(View(bim));
        }
        //[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));
        }