public Model.Doctor.Therapy NewTherapy(Model.Doctor.Therapy therapy) { List <Therapy> therapyList = ReadFromFile(); Therapy searchTherapy = GetTherapy(therapy.Id); if (searchTherapy != null) { return(null); } therapyList.Add(therapy); WriteInFile(therapyList); return(therapy); }
public Model.Doctor.Therapy SetTherapy(Model.Doctor.Therapy therapy) { List <Therapy> therapyList = ReadFromFile(); foreach (Therapy t in therapyList) { if (t.Id.Equals(therapy.Id)) { t.drug = therapy.drug; t.patientCard = therapy.patientCard; t.Id = therapy.Id; t.Anamnesis = therapy.Anamnesis; t.StartDate = therapy.StartDate; t.EndDate = therapy.EndDate; t.DailyDose = therapy.DailyDose; break; } } WriteInFile(therapyList); return(null); }
public Therapy(Therapy therapy) { if (therapy.drug == null) { this.drug = new Drug(); } else { this.drug = new Drug(therapy.drug); } if (therapy.patientCard == null) { this.patientCard = new PatientCard(); } else { this.patientCard = new PatientCard(therapy.patientCard); } this.Id = therapy.Id; this.Anamnesis = therapy.Anamnesis; this.StartDate = therapy.StartDate; this.EndDate = therapy.EndDate; this.DailyDose = therapy.DailyDose; }