コード例 #1
0
ファイル: LocationController.cs プロジェクト: cubitouch/Barly
        public JsonResult GetExternalInfos(int id)
        {
            var backOffice = new Business.BackOffice();
            Location location = backOffice.Locations.FirstOrDefault(l => l.Id == id);

            FoursquareVenue cacheItemFoursquare = null;
            if (!string.IsNullOrWhiteSpace(location.FoursquareID))
            {
                string cacheKeyFoursquare = "foursquare-venue-" + location.FoursquareID;
                cacheItemFoursquare = (FoursquareVenue)WebCache.Get(cacheKeyFoursquare);
                if (cacheItemFoursquare == null)
                {
                    cacheItemFoursquare = new FoursquareVenue(location.FoursquareID);
                    WebCache.Set(cacheKeyFoursquare, cacheItemFoursquare, 1440); // one day cache
                }
            }

            GoogleNearby cacheItemGoogle = null;
            string cacheKeyGoogle = "google-nearby-" + location.Id;
            cacheItemGoogle = (GoogleNearby)WebCache.Get(cacheKeyGoogle);
            if (cacheItemGoogle == null)
            {
                cacheItemGoogle = new GoogleNearby(location.Latitude, location.Longitude);
                WebCache.Set(cacheKeyGoogle, cacheItemGoogle, 1440); // one day cache
            }

            return Json(new LocationExternal(cacheItemFoursquare, cacheItemGoogle), JsonRequestBehavior.AllowGet);
        }
コード例 #2
0
ファイル: LocationExternal.cs プロジェクト: cubitouch/Barly
 public LocationExternal(FoursquareVenue foursquare, GoogleNearby google)
 {
     Foursquare = foursquare;
     Google     = google;
 }
コード例 #3
0
ファイル: LocationExternal.cs プロジェクト: cubitouch/Barly
 public LocationExternal(FoursquareVenue foursquare, GoogleNearby google)
 {
     Foursquare = foursquare;
     Google = google;
 }