Example #1
0
        public Task <PageResponse <ClientInfoDto> > GetPage(PageRequest <ClientFilter> request)
        {
            using (var db = new ApplicationDbContext())
            {
                var dbResult = db.Clients.AsQueryable();

                dbResult = Filter(request, dbResult);

                dbResult = Sort(request, dbResult);


                var total = dbResult.Count();
                var r     = dbResult.Skip(request.Skip).Take(request.Limit).ToList();

                var result = new PageResponse <ClientInfoDto>
                {
                    Data  = _mapper.ToInfoDto(r),
                    Total = total
                };

                return(Task.FromResult(result));
            }
        }