public static void UpdatePatient(AirwayPatient patient) { AirwayPatients airwayPatients = Deserialize(); int idx = airwayPatients.IndexOf(airwayPatients.FirstOrDefault(item => item.PatientId == patient.PatientId)); airwayPatients[idx] = patient; AirwayPatients.Serialize(airwayPatients); }
public void Save() { AirwayPatients airwayPatients = AirwayPatients.Deserialize(); for (int index = 0; index < airwayPatients.Count; index++) { AirwayPatient patient = airwayPatients[index]; if (patient.PatientId == this.PatientId) { airwayPatients[index] = this; } } AirwayPatients.Serialize(airwayPatients); }