Esempio n. 1
0
        public JsonResult TwitterProfileFeeds()
        {
            var caching = new SimbaToursEastAfrica.Caching.Concretes.SimbaToursEastAfricaCahing();

            var twitterEngine = new MartinLayooInc.SocialMedia.TwitterProfileFeed <Twitter.WidgetGroupItemList>();

            twitterEngine.TwitterProfileFiguration = this._twitterProfileFiguration;
            Twitter.WidgetGroupItemList tweets = new Twitter.WidgetGroupItemList();

            lock (_locker)
            {
                tweets = caching.GetOrSaveToCache(tweets, this._twitterProfileFiguration.Value.cachKey, this._twitterProfileFiguration.Value.cacheTimeSecs, twitterEngine.GetFeeds);


                if (tweets != null && tweets.Any())
                {
                    ViewBag.TwitterProfileFeeds = tweets;
                }
                else if (tweets == null || !tweets.Any())
                {
                    tweets = new Twitter.WidgetGroupItemList();
                }
            }
            return(Json(tweets));
        }
Esempio n. 2
0
        // GET: Twitter Feeds

        public async Task <IActionResult> TwitterProfileFeeds()
        {
            var caching = new SimbaToursEastAfrica.Caching.Concretes.SimbaToursEastAfricaCahing();

            var twitterEngine = new TwitterProfileFeed <WidgetGroupItemList>();

            twitterEngine.TwitterProfileFiguration = _twitterProfileFiguration;
            var tweets = new WidgetGroupItemList();

            Int32.TryParse(_twitterProfileFiguration["cacheTimeSecs"], out int cacheTimeSecs);
            tweets = await caching.GetOrSaveToCache <WidgetGroupItemList>(_twitterProfileFiguration["cachKey"], cacheTimeSecs, twitterEngine.GetFeeds);

            if (tweets != null && tweets.Any())
            {
                ViewBag.TwitterProfileFeeds = tweets;
            }
            else if (tweets == null || !tweets.Any())
            {
                tweets = new WidgetGroupItemList();
            }
            return(Ok(tweets));
        }