public void AddSymptom(string symptom) { if (!Symptoms.Contains(symptom)) { Symptoms.Add(symptom); } }
/// <summary> /// If was not find symptom from the `symptoms` list in the `contextSymptoms`: /// then add it in the Symptoms DB collection, /// else edit a found symptom in `contextSymptoms` list. /// </summary> /// <param name="symptoms">sourse list</param> /// <param name="contextSymptoms">edit in this list if found a symptom with same Id</param> private void AddOrEditSymptomsRange(ICollection <Symptom> symptoms, ICollection <Symptom> contextSymptoms) { foreach (var symptom in symptoms) { if (String.IsNullOrEmpty(symptom.Name)) { continue; } var item = contextSymptoms.FirstOrDefault(x => x.SymptomId == symptom.SymptomId); if (item != null) { item.Name = symptom.Name; } else { Symptoms.Add(new Symptom() { SymptomId = 0, Name = symptom.Name }); } } }
public void AddSymptom() { var symptom = new Symptom() { SymptomId = Guid.NewGuid(), SymptomName = Symptom.SymptomName, DoctorId = DoctorId }; Symptoms.Add(symptom); }