Beispiel #1
0
        public virtual async Task <PagedResult <TList> > GetPassives(PageRequest request)
        {
            try
            {
                var pagedData = await repository.AllPassives()
                                .ProjectTo <TList>(mapper.ConfigurationProvider)
                                .Skip((request.PageNumber - 1) * request.PageSize)
                                .Take(request.PageSize)
                                .ToListAsync();

                var count = await repository.AllPassives().CountAsync();

                return(new PagedResult <TList>(pagedData, request.PageNumber, request.PageSize, count));
            }
            catch (Exception ex)
            {
                Logger.LogError(ex, ex.Message);
                throw new ServiceException();
            }
        }