コード例 #1
0
ファイル: BansController.cs プロジェクト: magicxor/Hikkaba
        public async Task <IActionResult> Index(int page = 1, int size = 10)
        {
            var pageDto = new PageDto(page, size);
            var dtoList = await _banService.PagedListAsync(ban => (ban.End >= DateTime.UtcNow), ban => ban.Created, true);

            var detailsViewModels = _mapper.Map <IList <BanDetailsViewModel> >(dtoList.CurrentPageItems);
            var viewModelList     = new BanIndexViewModel
            {
                Bans = new BasePagedList <BanDetailsViewModel>
                {
                    TotalItemsCount  = dtoList.TotalItemsCount,
                    CurrentPage      = pageDto,
                    CurrentPageItems = detailsViewModels,
                },
            };

            return(View(viewModelList));
        }