示例#1
0
        public async Task <PaginationQueryResult <BeatmapExport> > GetExportList(
            int page                    = 0,
            int countPerPage            = 50,
            BeatmapOrderOptions options = BeatmapOrderOptions.UpdateTime)
        {
            var list      = Exports.AsNoTracking();
            var queryable = options switch
            {
                BeatmapOrderOptions.UpdateTime => list.OrderByDescending(k => k.CreateTime),
                _ => throw new ArgumentOutOfRangeException(nameof(options), options, null)
            };

            var count = await queryable.CountAsync();

            var collection = queryable
                             .Include(k => k.Beatmap);

            var result = await collection
                         .Skip(page *countPerPage)
                         .Take(countPerPage)
                         .ToListAsync();

            return(new PaginationQueryResult <BeatmapExport>(result, count));
        }