Exemple #1
0
        public async Task <long> GetCountAsync(string filterText = null,
                                               StudentQueryFilter studentQueryFilter = null,
                                               CancellationToken cancellationToken   = default)
        {
            var query = ApplyFilter(DbSet, filterText, studentQueryFilter);

            return(await query.LongCountAsync(GetCancellationToken(cancellationToken)));
        }
Exemple #2
0
        public async Task <List <Student> > GetListAsync(string filterText = null,
                                                         StudentQueryFilter studentQueryFilter = null,
                                                         string sorting     = null,
                                                         int maxResultCount = int.MaxValue,
                                                         int skipCount      = 0,
                                                         CancellationToken cancellationToken = default)
        {
            var query = ApplyFilter(DbSet, filterText, studentQueryFilter);

            if (string.IsNullOrWhiteSpace(sorting))
            {
                query = query.OrderBy(Student.DefaultSorting);
            }

            return(await query.PageBy(skipCount, maxResultCount).ToListAsync(cancellationToken));
        }