public ActionResult GetTweets() { var display = new DisplayTweets(); var tweetLog = _context.TweetLog.OrderByDescending(x => x.TweetDateTime).Take(500).ToList(); display.Tweets = tweetLog; display.DemocratTweets = _context.TweetLog.Count(x => x.Party == "D"); display.RepublicanTweets = _context.TweetLog.Count(x => x.Party == "R"); return(Ok(display)); }
public void OnGet() { var client = new RestClient { BaseUrl = new Uri(_config.GetSection("BaseAPI").Value) }; var request = new RestRequest { Resource = "GetTweets" }; var response = client.Execute(request); if (response.IsSuccessful) { var results = response.Content; // convert to Json Object Tweets = JsonConvert.DeserializeObject <DisplayTweets>(results); //var tweetLog = new Tweets { tweets = tweets }; } ViewData["tweets"] = Tweets; }