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

            return(countries);
        }
Ejemplo n.º 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));
        }
Ejemplo n.º 3
0
 public async Task <IActionResult> GET_COUNTRY([FromQuery] GetCountryQuery query)
 {
     return(Ok(await _mediator.Send(query)));
 }
Ejemplo n.º 4
0
 public async Task <ActionResult <CountryOutputModel> > GetById(
     [FromRoute] GetCountryQuery query)
 => await this.Send(query);