public void Delete(int idPatient) { var patient = _postgres.Patient.Find(idPatient); var consultations = _postgres.Сonsultation .Where(w => w.IdPatient == idPatient); _postgres.RemoveRange(consultations); _postgres.Remove(patient); _postgres.SaveChanges(); }
public long Create(Сonsultation consultation) { _postgres.Сonsultation.Add(consultation); _postgres.SaveChanges(); return(consultation.IdConsultation); }