Beispiel #1
0
        public async Task UpdateAllAnime()
        {
            logger.Log("Started UpdateAllAnime job.");

            int  page            = 0;
            int  pageSize        = 100;
            long totalAnimeCount = await animeRepository.CountAsync(x => true);

            while (page * pageSize < totalAnimeCount)
            {
                var animeCollection = await animeRepository.GetOrderedPageAsync(PredicateBuilder.True <Data.Model.Anime>(), "MalId ASC", page, pageSize);

                foreach (Data.Model.Anime anime in animeCollection.Results)
                {
                    JikanDotNet.Anime animeFullData = await SendSingleAnimeRequest(anime.MalId, 0);

                    if (animeFullData != null)
                    {
                        logger.Log($"Parsed anime with id {anime.MalId}: {anime.Title}");

                        await UpdateAnime(anime, animeFullData);
                    }
                    else
                    {
                        logger.Log($"Error on {anime.MalId} - not found");
                        continue;
                    }
                }

                page++;
            }
            logger.Log("Finished UpdateAllAnime job.");
        }
Beispiel #2
0
        public async Task <PagedResult <AnimeSearchEntryDto> > GetAsync(Query <AnimeSearchCriteria> query)
        {
            var expression = animeSearchCriteriaService.BuildExpression(query.SearchCriteria);

            var entities = await animeRepository.GetOrderedPageAsync(expression, query.SortExpression, query.Page, query.PageSize);

            return(mapper.Map <PagedResult <AnimeSearchEntryDto> >(entities));
        }