Пример #1
0
 public async Task AddAsync(Endereco endereco)
 {
     try {
         endereco.Validar();
         await _enderecoRepository.AddAsync(endereco);
     } catch (Exception) {
         throw;
     }
 }
Пример #2
0
        public async Task <SaveEnderecoResponse> SaveAsync(Endereco endereco)
        {
            try
            {
                await _enderecoRepository.AddAsync(endereco);

                await _unitOfWork.CompleteAsync();

                return(new SaveEnderecoResponse(endereco));
            }
            catch (Exception ex)
            {
                return(new SaveEnderecoResponse($"Erro ao salvar o endereco: {ex.Message}"));
            }
        }