Beispiel #1
0
        public async Task <IActionResult> OnGetAsync()
        {
            Gallery gallery = await _galleryService.GetGallery(Id);

            if (gallery == null)
            {
                return(NotFound());
            }
            int pageSize   = 12; //每页展示的漫画个数
            int comicCount = await _comicService.GetComicCount(Id);

            int maxPage = (comicCount + 1) / 12 + 1;

            GalleryName = gallery.Name;
            Console.WriteLine(PageNumber);
            Comics = await _comicService.GetComics(gallery, PageNumber.GetValueOrDefault(1) - 1, pageSize);

            Pagination = new PaginationModel()
            {
                StartPage   = 1,
                EndPage     = maxPage,
                CurrentPage = PageNumber.GetValueOrDefault(1),
            };
            Pagination.CreatePaginationItems();
            Pagination.Route       = "/Read/Gallery1";
            Pagination.RouteParams = new Dictionary <string, string>();
            //{
            //    {"id",Id.ToString() },
            //};
            foreach (var kv in RouteData.Values)
            {
                Pagination.RouteParams.Add(kv.Key, kv.Value.ToString());
            }
            return(Page());
        }