Пример #1
0
        public async Task <PaginatedResult <UserQueryResponse> > Handle(UsersQueryPaginated request, CancellationToken cancellationToken)
        {
            var users = await this.userRepository.GetAsync(page : request.PageNumber, pageSize : request.PageSize, orderBy : this.GenerateOrderBy(request.OrderBy, request.OrderIsAsc));

            var usersCount = await this.userRepository.CountAsync();

            var paginatedResult = PaginatedResult <UserQueryResponse> .MapFromRequestMappingEntities <User>(request, users, u => this.MapToResponse(u.Id, u.Name, u.Surname), usersCount);

            return(paginatedResult);
        }
Пример #2
0
        public async Task <IActionResult> GetUsersPaginated([FromQuery] UsersQueryPaginated query)
        {
            var users = await this._mediator.Send(query);

            return(this.Ok(users));
        }