Ejemplo n.º 1
0
 private void SaveDiagnosis(object sender, EventArgs e)
 {
     if (btnSave.Text == "Edit")
     {
         var exisitingDiagnosis = diagnosisRepository.GetById(diagnosisId);
         exisitingDiagnosis.PatientId = Convert.ToInt32(txtPatientId.Text);
         exisitingDiagnosis.Illness   = txtIllness.Text;
         exisitingDiagnosis.Date      = txtDate.Text;
         if (diagnosisRepository.Update(exisitingDiagnosis) > 0)
         {
             MessageBox.Show("Updated successfully");
         }
     }
     else
     {
         var diagnosis = new Diagnosis();
         diagnosis.PatientId = Convert.ToInt32(txtPatientId.Text);
         diagnosis.Illness   = txtIllness.Text;
         diagnosis.Date      = txtDate.Text;
         if (diagnosisRepository.Add(diagnosis) > 0)
         {
             MessageBox.Show("Saved successfully");
         }
     }
     Clear();
     FillDataGridView();
 }
Ejemplo n.º 2
0
 public void Update(Diagnosis entity)
 => _diagnosisRepository.Update(entity);