Exemplo n.º 1
0
        public async Task <WrapperSimpleTypesDTO> InteractuarRssFeed(List <RssFeeds> rssFeedParaInteractuar)
        {
            using (SportsGoEntities context = new SportsGoEntities(false))
            {
                NoticiasRepository noticiaRepo = new NoticiasRepository(context);

                foreach (var feed in rssFeedParaInteractuar)
                {
                    if (feed.Consecutivo <= 0)
                    {
                        noticiaRepo.CrearRssFeed(feed);
                    }
                    else
                    {
                        RssFeeds feedExistente = await noticiaRepo.ModificarRssFeed(feed);
                    }
                }

                WrapperSimpleTypesDTO wrapperInteractuarRssFeed = new WrapperSimpleTypesDTO();

                wrapperInteractuarRssFeed.NumeroRegistrosAfectados = await context.SaveChangesAsync();

                if (wrapperInteractuarRssFeed.NumeroRegistrosAfectados > 0)
                {
                    wrapperInteractuarRssFeed.Exitoso = true;
                }

                return(wrapperInteractuarRssFeed);
            }
        }