Esempio n. 1
0
        public async Task <List <News> > ObtainNews()
        {
            _logger.Log(LogPriority.Info, "Obtaining news...");
            List <News> obtainedNews = Obtain();

            _logger.Log(LogPriority.Info, $"Obtained {obtainedNews.Count} news.");

            if (!obtainedNews.IsNullOrEmpty())
            {
                List <News> insertedNews = await _newsRepo.AddMany(obtainedNews);

                int insertedCount = obtainedNews.Count - insertedNews.Count;
                int updatedCount  = obtainedNews.Count - insertedCount;

                _logger.Log(LogPriority.Info, $"Inserted {insertedCount} and updated {updatedCount} news.");
            }

            return(obtainedNews);
        }