Beispiel #1
0
        public async Task LoadMangas(int skip = 0)
        {
            const int takeCount = 21;

            var chapters = await _mangaService.ListAsync(new DataServices.ListRequest
            {
                Skip = skip,
                Take = takeCount
            });

            foreach (var chapter in chapters)
            {
                var pages = chapter.PagesJson?.Split('|').Where(x => !string.IsNullOrEmpty(x));
                if (pages.Any())
                {
                    var poster = string.IsNullOrEmpty(chapter.Poster) ? pages.FirstOrDefault() : chapter.Poster;
                    chapter.Poster = poster.Replace("upload/", "upload/c_thumb,w_300/");
                }
            }

            Mangas.Clear();
            Mangas.AddRange(chapters);

            FeaturedMangas.Clear();
            FeaturedMangas.AddRange(chapters.OrderByDescending(x => x.ChapterNumber).Take(3));
        }