public void Remove(DeleteEnderecoCommand command) { var endereco = enderecoRepository.GetById(command.Id); if (endereco == null) { throw new Exception("Endereço não encontrado."); } enderecoRepository.Remove(endereco); }
public IActionResult Delete(int id) { try { var command = new DeleteEnderecoCommand { Id = id }; enderecoApplicationService.Remove(command); return(Ok(new { Message = "Endereço excluido com sucesso." })); } catch (Exception e) { return(StatusCode(500, e.Message)); } }