public JsonResult RecentTweets(int id, string word, DateTime?startDate, DateTime?endDate) { startDate = startDate ?? DateTime.UtcNow.AddHours(-4); endDate = endDate ?? DateTime.UtcNow; var tweets = _tweetsRepository.GetTweetsInDateRange(id, (DateTime)startDate, (DateTime)endDate) .Where(t => t.Text.ToLower().Contains(word.ToLower())); var minimalTweets = tweets.Select(i => new { i.TwitterUserId, TwitterUserScreenName = i.User.ScreenName, TwitterUserProfileImage = i.User.ProfileImageUrl, i.Text, CreatedDate = i.CreatedDate.ToString("MM/dd/yy H:mm tt"), id = i.Id.ToString() }); return(Json(minimalTweets)); }
public List <Tweet> GetTweetsInDateRange(long searchId, DateTime startDate, DateTime endDate) { return(_tweetsRepository.GetTweetsInDateRange(searchId, startDate, endDate)); }