Пример #1
0
        /// <summary>
        ///     分页获取角色
        /// </summary>
        /// <param name="predicates"></param>
        /// <param name="input"></param>
        /// <returns></returns>
        public async Task <Tuple <List <Role>, int> > GetPagedRoleAsync(List <AprilPredicate <Role> > predicates,
                                                                        PageQueryEntity input)
        {
            var tuple = await _roleRepository.QueryAsync(predicates, input);

            return(tuple);
        }
Пример #2
0
        /// <summary>
        ///     分页获取管理员
        /// </summary>
        /// <param name="predicates"></param>
        /// <param name="input"></param>
        /// <param name="includeNames"></param>
        /// <returns></returns>
        public async Task <Tuple <List <Manager>, int> > GetPagedMemberAsync(List <AprilPredicate <Manager> > predicates,
                                                                             PageQueryEntity input, List <string> includeNames)
        {
            var tuple = await _managerRepository.QueryAsync(predicates, input, includeNames);

            return(tuple);
        }
Пример #3
0
        /// <summary>
        ///     获取分页包含子结果集
        /// </summary>
        /// <param name="predicateList"></param>
        /// <param name="pageQueryEntity"></param>
        /// <param name="includeNames"></param>
        /// <returns></returns>
        public async Task <Tuple <List <TEntity>, int> > QueryAsync(List <AprilPredicate <TEntity> > predicateList, PageQueryEntity pageQueryEntity, List <string> includeNames)
        {
            var query = GetAll();

            includeNames?.Aggregate(query, (current, item) => current.Include(item));
            var totalCount = query.Count();
            var data       = await query
                             .OrderBy(pageQueryEntity.Sorting)
                             .PageBy(pageQueryEntity.SkipCount, pageQueryEntity.MaxResultCount)
                             .ToListAsync();

            return(new Tuple <List <TEntity>, int>(data, totalCount));
        }
Пример #4
0
        /// <summary>
        ///     获取分页数据
        /// </summary>
        /// <param name="predicateList"></param>
        /// <param name="pageQueryEntity"></param>
        /// <returns></returns>
        public async Task <Tuple <List <TEntity>, int> > QueryAsync(List <AprilPredicate <TEntity> > predicateList, PageQueryEntity pageQueryEntity)
        {
            var query = GetAll();

            query = query.WhereIf(predicateList);
            var totalCount = query.Count();
            var data       = await query
                             .OrderBy(pageQueryEntity.Sorting)
                             .PageBy(pageQueryEntity.SkipCount, pageQueryEntity.MaxResultCount)
                             .ToListAsync();

            return(new Tuple <List <TEntity>, int>(data, totalCount));
        }