コード例 #1
0
        public async Task <IActionResult> Index(UserStatusFilterModel filter)
        {
            var filterRequest = new UserStatusFilter()
            {
                Page     = filter.Page,
                PageSize = _pagerOptions.PageSize,
                Keyword  = filter.Search
            };

            var statusPageList = await _userStatusService.GetAsync(filterRequest);

            var statuses = statusPageList.Collections.Select(x => new UserStatusModel()
            {
                Id          = x.Id,
                Name        = x.Name,
                Description = x.Description
            });

            var statusPage = new PageListModel <UserStatusModel>(statuses)
            {
                Filter      = filter,
                TotalPage   = statusPageList.TotalPage,
                TotalResult = statusPageList.TotalResult
            };

            if (_httpHelper.IsAjaxRequest(Request))
            {
                return(PartialView("_UserStatusTable", statusPage));
            }

            return(View(statusPage));
        }