public async Task <ActionResult <MoradorViewModel> > Excluir(Guid id) { if (!MoradorExists(id)) { return(NotFound()); } await _moradorService.Delete(id); return(CustomResponse()); }
public async override Task Delete(Guid id) { var endereco = await _enderecoService.ObterEnderecoCasa(id); if (endereco != null) { await _enderecoService.Delete(endereco.Id); } var moradores = await _moradorService.ObterMoradoresCasa(id); foreach (var morador in moradores) { await _moradorService.Delete(morador.Id); } await base.Delete(id); }