public void Update(PatientHistory model) { using (var db = new DbManager()) { var query = new SqlQuery<PatientHistory>(); query.Update(model); } }
public void Insert(PatientHistory model) { using (var db = new DbManager()) { var query = new SqlQuery<PatientHistory>(); query.Insert(model); } }
public void InsertOrUpdate(PatientHistory model) { var modelInDb = this.FindById(model.ID); if (modelInDb == null) this.Insert(model); else this.Update(model); }
private void btnSave_Click(object sender, EventArgs e) { PatientHistoryAccessor patientAccessor = new PatientHistoryAccessor(); var patient = new PatientHistory(); patient.ID = this._id; patient.PatientID = (int)cboPatient.SelectedValue; patient.DoctorID = (int)cboDoctor.SelectedValue; patient.Medicine = txtMedicine.Text; patient.Description = txtDescription.Text; patient.CheckDate = dtpCheckDate.Value; patient.AppointmentDate = dtpAppointmentDate.Value; patientAccessor.InsertOrUpdate(patient); this.Close(); }