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()); }
public async Task OnGetAsync() { var galleries = await _galleryService.GetAllGalleries(); foreach (var gallery in galleries) { gallery.Comics = await _comicService.GetComics(gallery, 0, 6); } Galleries = galleries; }
public ActionResult <IEnumerable <Comic> > Get() { return(_comicService.GetComics()); }