public void SeedChronicDisease(HealthDbContext db) { string[] diseaseNames = { "Alzheimer diseaseanddementia", "Arthritis", "Asthma", "Cancer", "COPD", "Crohn disease", "Cystic fibrosis", "Diabetes", "Epilepsy", "Heart disease", "HIV/AIDS", "Mood disorders (bipolar,cyclothymic, anddepression)", "Multiple sclerosis", "Parkinson disease" }; List <ChronicDisease> chronicDiseases = new List <ChronicDisease>(); for (int counter = 0; counter < diseaseNames.Length; counter++) { ChronicDisease chronicDisease = new ChronicDisease() { Name = diseaseNames[counter] }; chronicDiseases.Add(chronicDisease); } db.ChronicDiseases.AddRange(chronicDiseases); db.SaveChanges(); }
public void AddPersonDiseaseInfo(string doctorId, string personId, PersonDiseaseInfoInputModel personDiseaseInfoInputModel) { int diseaseId = this.diseasesService.GetDiseaseId(personDiseaseInfoInputModel.Name); ChronicDisease chronicDisease = null; if (diseaseId == 0) { diseaseId = this.diseasesService.Add(personDiseaseInfoInputModel.Name); chronicDisease = this.diseasesService.GetDisease(diseaseId); } else { chronicDisease = this.diseasesService.GetDisease(diseaseId); } PersonChronicDisease personChronicDisease = new PersonChronicDisease() { DoctorId = doctorId, PersonId = personId, DiagnosedOn = DateTime.Parse(personDiseaseInfoInputModel.DiagnosedOn), ChronicDisease = chronicDisease }; this.db.PersonChronicDiseases.Add(personChronicDisease); this.db.SaveChanges(); }
public int Add(string name) { ChronicDisease chronicDisease = new ChronicDisease() { Name = name }; this.db.ChronicDiseases.Add(chronicDisease); this.db.SaveChanges(); return((int)this.GetDiseaseId(chronicDisease.Name)); }
public PatientBuilder AddComorbidity(ChronicDisease comorbidity) { _comorbidities.Add(comorbidity); return(this); }