示例#1
0
        public async Task <List <MemberDto> > Handle(GetAllMembersQuery request, CancellationToken cancellationToken)
        {
            var membersList = await _dbContext.Members.ToListAsync(cancellationToken);

            return(membersList.Select(member => member.Adapt <MemberDto>())
                   .OrderBy(x => x.SurName).ToList());
        }
示例#2
0
 public async Task <IEnumerable <MemberListDTO> > Handle(GetAllMembersQuery request, CancellationToken cancellationToken)
 {
     return(await _Context.Members
            .ProjectTo <MemberListDTO>(_Mapper.ConfigurationProvider)
            .AsNoTracking()
            .ToListAsync(cancellationToken));
 }
        public async Task <IActionResult> GetAllMembers()
        {
            var query  = new GetAllMembersQuery();
            var result = await _mediator.Send(query);

            return(Ok(result));
        }
示例#4
0
        public async Task <List <MemberDto> > Handle(GetAllMembersQuery request, CancellationToken cancellationToken)
        {
            var result = await _unitOfWork.Members.GetAll();

            return(_mapper.Map <List <MemberDto> >(result.ToList()));
        }