示例#1
0
        /// <summary>
        /// Returns all of the trends near a given latitude and longitude
        /// </summary>
        /// <param name="latitude"></param>
        /// <param name="longitude"></param>
        public List <ITrend> TrendingTweets(double latitude, double longitude)
        {
            var list = new List <ITrend>();
            var closestTrendLocations = Trends.GetClosestTrendLocations(latitude, longitude);

            foreach (var item in closestTrendLocations)
            {
                var trends = Trends.GetTrendsAt(item.WoeId).Trends;

                foreach (var trend in trends)
                {
                    if (!list.Contains(trend))
                    {
                        list.Add(trend);
                    }
                }
            }

            return(list);
        }
 public ITrend[] GetTrends(int id)
 {
     if (ISScontext != null)
     {
         var closestTrendLocations = Trends.GetClosestTrendLocations(ISScontext[id].lat, ISScontext[id].lng);
         if (closestTrendLocations != null)
         {
             var woe = closestTrendLocations.ElementAt(0).WoeId;
             try
             {
                 var trendingTopics = Trends.GetTrendsAt(woe);
                 return(trendingTopics.Trends.ToArray());
             }
             catch (NullReferenceException)
             {
                 return(null);
             }
         }
         return(null);
     }
     return(null);
 }
        public IActionResult GetTrendsLocation()
        {
            var closestTrendLocations = Trends.GetClosestTrendLocations(37.8, -122.4);

            return(Ok(closestTrendLocations));
        }