public async Task <IActionResult> Aggregate(CreateNewsViewModel createNewsViewModel)
        {
            var rsssouses = await _rssSourceService.GetAllRssSourceAsync(false);

            var newInfos = new List <NewsInfoFromRssSourseDto>(); // without any duplicate

            foreach (var item in rsssouses)
            {
                if (/*item.Name.Equals("TUT.by")||*/ item.Name.Equals("Onliner") || item.Name.Equals("igromania") || item.Name.Equals("OON"))
                {
                    var newsList = await _newsService.GetNewsInfoFromRssSourse(item);

                    newInfos.AddRange(newsList);
                }
            }
            ;

            await _newsService.CreateManyNewsAsync(newInfos);

            return(RedirectToAction(nameof(Index)));
        }
Exemple #2
0
        public async Task <IActionResult> Get()
        {
            try
            {
                var sources = await _rssSourceService.GetAllRssSourceAsync(false);

                return(Ok(sources));
            }
            catch (Exception ex)
            {
                Log.Error(ex.Message);
                return(BadRequest(ex.Message));

                throw;
            }
        }
        public async Task Aggregate()
        {
            var rsssouses = await _rssSourceService.GetAllRssSourceAsync(false);

            var newInfos = new List <NewsInfoFromRssSourseDto>(); // without any duplicate

            foreach (var item in rsssouses)
            {
                if (/*item.Name.Equals("TUT.by") ||*/ item.Name.Equals("Onliner") || item.Name.Equals("igromania") || item.Name.Equals("OON"))
                {
                    var newsList = await GetNewsInfoFromRssSourse(item);

                    newInfos.AddRange(newsList);
                }
            }
            ;

            await CreateManyNewsAsync(newInfos);
        }
Exemple #4
0
        public async Task <IActionResult> Index()
        {
            var rssSource = await _rssSourceService.GetAllRssSourceAsync(false);

            return(View(rssSource));
        }