public async Task <bool> deleteAsync(long id) { try { var cita = await findByIdAsync(id); if (cita == null) { return(true); } if (cita.diagnostico != null) { await diagRepo.DeleteDiagnosticoAsync(cita.diagnostico.id); } await citaRepo.DeleteCitaAsync(id); return(true); } catch (Exception) { return(false); } }
public async Task <bool> deleteAsync(long id) { try { Medico med = await medRepo.GetMedicoAsync(id); med.pacientes = new HashSet <MedicoPaciente>(); await this.updateAsync(med); foreach (Cita c in med.citas) { await diagRepo.DeleteDiagnosticoAsync(c.diagnostico.id); await citaRepo.DeleteCitaAsync(c.id); } med.citas = new HashSet <Cita>(); await medRepo.DeleteMedicoAsync(id); return(true); } catch (Exception) { return(false); } }
public async Task <bool> deleteAsync(long id) { try { Paciente pac = await pacRepo.GetPacienteAsync(id); pac.medicos = new HashSet <MedicoPaciente>(); await this.updateAsync(pac); foreach (Cita c in pac.citas) { await diagRepo.DeleteDiagnosticoAsync(c.diagnostico.id); await citaRepo.DeleteCitaAsync(c.id); } pac.citas = new HashSet <Cita>(); await pacRepo.DeletePacienteAsync(id); return(true); } catch (Exception) { return(false); } }