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()); }
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)); }
public async Task <List <MemberDto> > Handle(GetAllMembersQuery request, CancellationToken cancellationToken) { var result = await _unitOfWork.Members.GetAll(); return(_mapper.Map <List <MemberDto> >(result.ToList())); }