示例#1
0
        public async Task <ActionResult> Index(int?p, string search)
        {
            var pageIndex = p ?? 1;
            var allEmails = string.IsNullOrWhiteSpace(search)
                ? await _bannedWordService.GetAllPaged(pageIndex, SiteConstants.Instance.AdminListPageSize)
                : await _bannedWordService.GetAllPaged(search, pageIndex, SiteConstants.Instance.AdminListPageSize);

            var viewModel = new BannedWordListViewModel
            {
                Words      = allEmails,
                PageIndex  = pageIndex,
                TotalCount = allEmails.TotalCount,
                Search     = search
            };

            return(View(viewModel));
        }
        public ActionResult Index(int?p, string search)
        {
            using (UnitOfWorkManager.NewUnitOfWork())
            {
                var pageIndex = p ?? 1;
                var allEmails = string.IsNullOrEmpty(search) ? _bannedWordService.GetAllPaged(pageIndex, SiteConstants.Instance.AdminListPageSize) :
                                _bannedWordService.GetAllPaged(search, pageIndex, SiteConstants.Instance.AdminListPageSize);

                var viewModel = new BannedWordListViewModel
                {
                    Words      = allEmails,
                    PageIndex  = pageIndex,
                    TotalCount = allEmails.TotalCount,
                    Search     = search
                };

                return(View(viewModel));
            }
        }