public static List <PatientDiseases> GetPatientActiveDiseases(string bdResult) { var values = bdResult.Split('*'); var result = new List <PatientDiseases>(); if (bdResult == "") { result.Add(new PatientDiseases()); } else { for (int i = 0; i < values.Length; i += 2) { var Diseases = new PatientDiseases() { Id = Convert.ToInt32(values.GetValue(i)), Name = values.GetValue(1 + i).ToString() }; result.Add(Diseases); } } return(result); }
/// <summary> /// Adds the disease to the patient /// </summary> /// <param name="patientDisease">The new patient disease</param> /// <returns> /// The identifier of added patient disease /// </returns> public int AddDiseaseToPatient(PatientDisease patientDisease) { this.PatientDiseases.Add(patientDisease); this.SaveChanges(); return(PatientDiseases.Last <PatientDisease>().PatientDiseaseId); }