Example #1
0
 /// <summary>
 /// 输出模型
 /// </summary>
 /// <param name="pagedto"></param>
 /// <param name="leaguer"></param>
 public LeaguerInfoOutPage(PagedResultDto <YaeherPatientLeaguerInfo> pagedto, LeaguerInfo leaguer)
 {
     Items          = pagedto.Items;
     TotalCount     = pagedto.TotalCount;
     TotalPage      = pagedto.TotalCount / leaguer.MaxResultCount;
     SkipCount      = leaguer.SkipCount;
     MaxResultCount = leaguer.MaxResultCount;
 }
 public async Task <List <YaeherPatientLeaguerInfo> > LeaguerInfoList(LeaguerInfo Leaguer)
 {
     return(await _leaguerRepository.GetAllListAsync(Leaguer.Expression));
 }
        public async Task <PagedResultDto <YaeherPatientLeaguerInfo> > LeaguerInfoPage(LeaguerInfo input)
        {
            //初步过滤
            var query = _leaguerRepository.GetAll().OrderByDescending(a => a.CreatedOn).Where(input.Expression);
            //获取总数
            var tasksCount = query.Count();
            //获取总数
            var totalpage = tasksCount / input.MaxResultCount;
            //默认的分页方式
            //var taskList = query.Skip(input.SkipTotal).Take(input.MaxResultCount).ToList();
            //ABP提供了扩展方法PageBy分页方式
            var taskList = await query.OrderBy(t => t.LeaguerName).ThenBy(t => t.Sex).PageBy(input.SkipTotal, input.MaxResultCount).ToListAsync();

            //IQueryable<YaeherPatientLeaguerInfo> querys = null;
            //querys = from items in query orderby items.LeaguerName, items.Sex select items;
            //var taskLists = await querys.PageBy(input.SkipTotal, input.MaxResultCount).ToListAsync();

            return(new PagedResultDto <YaeherPatientLeaguerInfo>(tasksCount, taskList.MapTo <List <YaeherPatientLeaguerInfo> >()));
        }