コード例 #1
0
        public async Task <IActionResult> GetTaxRate([FromQuery] TaxRateRequestDto taxRateRequestDto)
        {
            var taxRate = await _taxCalculatorService.GetTaxRateForLocation(new Location { Zip = taxRateRequestDto.Zip });

            if (taxRate == null)
            {
                _logger.LogDebug(string.Format("Tax rate not found for zip {0}", taxRateRequestDto.Zip));
                throw new TaxRateNotFoundException(taxRateRequestDto.Zip);
            }
            return(Ok(_mapper.Map <TaxRateResponseDto>(taxRate)));
        }