public IEnumerable <TweetViewModel> GetAll() { IEnumerable <Tweet> tweetsEntity = tweetRepository.GetAll(); IEnumerable <TweetViewModel> tweets = mapper.Map <IEnumerable <TweetViewModel> >(tweetsEntity); return(tweets); }
public async Task <int> GetTotalDownloadedTweets() { var totalDownloadedTweets = await tweetRepository.GetAll(); Guard.WhenArgument(totalDownloadedTweets, "Total Downloaded Tweets").IsNull().Throw(); return(totalDownloadedTweets.Count()); }
public void AnalyzeTweetsByHour() { _tweetsByHourRepository.RemoveAll(); var listByHour = _tweetRepository.GetAll() .GroupBy(q => new { date = DateTime.ParseExact(q.CreatedAt, "ddd MMM dd HH:mm:ss +0000 yyyy", CultureInfo.InvariantCulture).Date, hour = DateTime.ParseExact(q.CreatedAt, "ddd MMM dd HH:mm:ss +0000 yyyy", CultureInfo.InvariantCulture).Hour }) .Select(s => new { date = s.Key.date, hour = s.Key.hour, count = s.Count() }); if (listByHour != null && listByHour.ToList().Count() > 0) { foreach (var item in listByHour.ToList()) { var tweetByHour = new TweetsByHour(Guid.NewGuid(), item.date, item.hour, item.count); _tweetsByHourRepository.Add(tweetByHour); } } }
public IActionResult Get() { var list = _tweetRepository.GetAll(); for (int i = 0; i < list.Count; i++) { var lan = _azureService.DetectLanguageServiceForAString(list[i].TweetText); var language = lan.Documents[0].DetectedLanguages[0].Iso6391Name; if (list[i].Language == null) { list[i].Language = language; _tweetRepository.Update(list[i]); } } return(Ok(list)); }
public List <TweetResponse> GetAll() { var list = Mapper.Map <List <TweetEntity>, List <TweetResponse> >(_tweetRepository.GetAll().ToList()); return(list); }
public object GetTweets(string msg) { return(TweetRepository.GetAll().OrderByDescending(x => x.CreateTime).ToList()); }
public IHttpActionResult GetAll() { var tweets = _tweetRepository.GetAll(); return(Ok(tweets)); }