public async Task <IEnumerable <CountryDto> > Handle(GetCountryQuery request, CancellationToken cancellationToken)
        {
            var countries = (await _locationRepository.GetCountriesAsync())
                            .Select(x => new CountryDto(x.Country));

            return(countries);
        }
Beispiel #2
0
        private async Task <ICountry> GetCountry(string countryCode)
        {
            NullGuard.NotNullOrWhiteSpace(countryCode, nameof(countryCode));

            IGetCountryQuery query = new GetCountryQuery
            {
                CountryCode = countryCode
            };

            return(await _queryBus.QueryAsync <IGetCountryQuery, ICountry>(query));
        }
Beispiel #3
0
 public async Task <IActionResult> GET_COUNTRY([FromQuery] GetCountryQuery query)
 {
     return(Ok(await _mediator.Send(query)));
 }
 public async Task <ActionResult <CountryOutputModel> > GetById(
     [FromRoute] GetCountryQuery query)
 => await this.Send(query);