예제 #1
0
        public AddressDTO GetAddressCode(string option)
        {
            option = option.Replace("-", "");

            if (!option.InputIsValid())
            {
                Console.WriteLine($"\n======================\n" +
                                  "Na opção de busca por CEP, digite o CEP apenas com números e/ou com separação por hífen." +
                                  $"\n======================\n");
            }

            Address address = _addressRepository.GetAddressByZipCode(option);

            AddressDTO addressDTO = new AddressDTO();

            return(address == null ? addressDTO = _httpClientService.GetAddressByZipCodeApi(option) : addressDTO = _mapper.Map <AddressDTO>(address));
        }