public static void AddSingleRelationship(DataBaseContext context, DbTreatmentHistory treatmentHistory, DbTreatment treatment) { context.TreatmentHistories.SingleOrDefault(th => th.Id == treatmentHistory.Id).Treatments.Add(context.Treatments.SingleOrDefault(t => t.Id == treatment.Id)); }
public static void AddSingleRelationship(DataBaseContext context, DbTreatmentHistory treatmentHistory, DbPatient patient) { context.Patients.SingleOrDefault(p => p.Id == patient.Id).TreatmentHistory = context.TreatmentHistories.SingleOrDefault(th => th.Id == treatmentHistory.Id); }