public ActionResult Index() { var model = new GetApprovalInput { FilterText = Request.QueryString["filterText"] }; return(View(model)); }
/// <summary> /// 根据查询条件获取企业注册审批分页列表 /// </summary> public async Task <PagedResultDto <ApprovalListDto> > GetPagedApprovalsAsync(GetApprovalInput input) { var query = (from approval in _approvalRepositoryAsNoTrack join company in _companyRepository.GetAll().AsNoTracking() on approval.CompanyID equals company.CompanyID select new { approval, company.CompanyName }).WhereIf(!string.IsNullOrEmpty(input.FilterText), t => t.CompanyName.Contains(input.FilterText.Trim())) .WhereIf(input.isPay != null, t => t.approval.IsPay == input.isPay) .WhereIf(input.isShow != null, t => t.approval.IsShow == input.isShow); //TODO:根据传入的参数添加过滤条件 var approvalCount = await query.CountAsync(); var approvals = await query .OrderByDescending(t => t.approval.RegisterDate).Skip(input.SkipCount * input.MaxResultCount).Take(input.MaxResultCount).ToListAsync(); return(new PagedResultDto <ApprovalListDto>( approvalCount, approvals.Select( item => { var dto = new ApprovalListDto(); dto.Id = item.approval.Id; dto.CompanyID = item.approval.CompanyID; dto.CompanyName = item.CompanyName; dto.RegisterDate = item.approval.RegisterDate; dto.IsPay = item.approval.IsPay; dto.PayAmount = item.approval.PayAmount; dto.PayTime = item.approval.PayTime; dto.CoopTime = item.approval.CoopTime; dto.Weight = item.approval.Weight; dto.isShow = item.approval.IsShow; dto.CreationTime = item.approval.CreationTime; return dto; }).ToList() )); }