[HttpGet] // GET: heroes public async Task <IActionResult> GetAll() { var query = new GetAllHeroesQuery(); var result = await _mediator.Send(query); return(Ok(result)); }
public async Task <IEnumerable <HeroDto> > Handle(GetAllHeroesQuery request, CancellationToken cancellationToken) { var heroes = await _heroRepository.GetAllHeroesAsync(); return(_mapper.Map <IEnumerable <HeroDto> >(heroes)); }