コード例 #1
0
ファイル: Pregunta de examen.cs プロジェクト: Luis5000/Repos
 private void btnGuardar_Click(object sender, EventArgs e)
 {
     using (DataContext dataContext = new DataContext())
     {
         ExamQuestion ExamQuestion =
             examQuestionBindingSource.Current as ExamQuestion;
         if (ExamQuestion != null)
         {
             if (dataContext.Entry <ExamQuestion>(ExamQuestion).State == EntityState.Detached)
             {
                 dataContext.Set <ExamQuestion>().Attach(ExamQuestion);
             }
             if (ExamQuestion.Id == 0)
             {
                 dataContext.Entry <ExamQuestion>(ExamQuestion).State = EntityState.Added;
             }
             else
             {
                 dataContext.Entry <ExamQuestion>(ExamQuestion).State = EntityState.Modified;
             }
             dataContext.SaveChanges();
             MetroFramework.MetroMessageBox.Show(this, "Pregunta de Examen guardada");
             grdDatos.Refresh();
             pnlDatos.Enabled = false;
         }
     }
 }
コード例 #2
0
ファイル: Pregunta de examen.cs プロジェクト: Luis5000/Repos
 private void grdDatos_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     ExamQuestion ExamQuestion = examQuestionBindingSource.Current as ExamQuestion;
 }