Ejemplo n.º 1
0
        public async Task <IEnumerable <INewsItem> > Get(
            [FromQuery] int maxResults,
            [FromQuery] string excludedSources)
        {
            var excludedSourcesArray = DeserializeExcludedSources(excludedSources);

            return(await _database.GetAsync(maxResults, excludedSourcesArray));
        }
Ejemplo n.º 2
0
        private async Task<IEnumerable<NewsItemEntity>> GetNewItems()
        {
            IEnumerable<INewsItem> news = await GetNews();
            IEnumerable<INewsItem> currentNews = await _database.GetAsync();

            return news
                .Where(item => !WasItemAdded(currentNews, item))
                .Select(item => new NewsItemEntity(item));
        }