public async Task <ActionResult> All(int?page) { var input = GetAllBookInput(page); var output = await _bookservice.GetAllAsync(input); return(PreViewActionResult(output)); }
// GET: Books //[UnitOfWork]//启用工作单元 public async Task <ActionResult> Index(string SeachText, string currentFilter, string sortOrder, int?page) { ViewBag.NameSortParm = sortOrder; var pageSize = 3;//页大小 if (SeachText != null) { page = 1; } else { SeachText = currentFilter; } var pageNumber = page ?? 1;//第几页 ViewBag.CurrentFilter = SeachText; PageInput pageInput = new PageInput() { pageIndex = pageNumber, pageMax = pageSize }; SeachInput seachInput = new SeachInput() { SeachBookName = SeachText }; OrderInput orderInput = new OrderInput() { OrderName = ViewBag.NameSortParm }; var BookList = await _bookAppService.GetAllAsync(pageInput, seachInput, orderInput); var onePageOfBook = new StaticPagedList <BookListoutput>(BookList.Items, pageNumber, pageSize, BookList.TotalCount); //将分页结果放入ViewBag供View使用 ViewBag.OnePageOfTasks = onePageOfTasks; //pageNumber, pageSize, counts 页索引 页大小 总数 ViewBag.OnePageOfTasks = onePageOfBook; return(View()); }