public void AddPersonDiseaseInfo(string doctorId, string personId, PersonDiseaseInfoInputModel diseaseInputModel) { Vaccine vaccine = null; int vaccineId = this.vaccinesService.GetVaccineId(diseaseInputModel.Name); if (vaccineId == 0) { vaccineId = this.vaccinesService.Add(diseaseInputModel.Name); vaccine = vaccinesService.GetVaccine(vaccineId); } else { vaccine = vaccinesService.GetVaccine(vaccineId); } PersonVaccine personVaccine = new PersonVaccine() { DoctorId = doctorId, PersonId = personId, Vaccine = vaccine, DiagnosedOn = DateTime.Parse(diseaseInputModel.DiagnosedOn) }; this.db.PersonVaccines.Add(personVaccine); this.db.SaveChanges(); }
public void AddPersonDiseaseInfo(string doctorId, string personId, PersonDiseaseInfoInputModel diseaseInputModel) { Allergy allergy = null; int allergyId = this.allergiesService.GetAllergyId(diseaseInputModel.Name); if (allergyId == 0) { allergyId = allergiesService.Add(diseaseInputModel.Name); allergy = this.allergiesService.GetAllergy(allergyId); } else { allergy = this.allergiesService.GetAllergy(allergyId); } PersonAllergy personAllergy = new PersonAllergy() { DoctorId = doctorId, PersonId = personId, Allergy = allergy, DiagnosedOn = DateTime.Parse(diseaseInputModel.DiagnosedOn) }; this.db.PersonAllergies.Add(personAllergy); this.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(); }