Exemple #1
0
        public ActionResult Index()
        {
            var model = new GetT_StaffInput {
                FilterText = Request.QueryString["filterText"]
            };

            return(View(model));
        }
        /// <summary>
        /// 根据查询条件获取人员信息表分页列表
        /// </summary>
        public async Task <PagedResultDto <T_StaffListDto> > GetPagedT_StaffsAsync(GetT_StaffInput input)
        {
            var query = _t_StaffRepository.GetAll().WhereIf(input.FK_Staff_GroupId >= 1, o => o.FK_Staff_GroupId == input.FK_Staff_GroupId).
                        WhereIf(!string.IsNullOrWhiteSpace(input.FilterText), o => o.StaffName.Contains(input.FilterText));;
            //TODO:根据传入的参数添加过滤条件

            var t_StaffCount = await query.CountAsync();

            var t_Staffs = await query
                           .OrderBy(input.Sorting)
                           .PageBy(input)
                           .ToListAsync();

            var t_StaffListDtos = t_Staffs.MapTo <List <T_StaffListDto> >();

            return(new PagedResultDto <T_StaffListDto>(
                       t_StaffCount,
                       t_StaffListDtos
                       ));
            //return new JtableResult<List<T_StaffListDto>>(t_StaffCount, t_StaffListDtos);
        }