private void TxtAddQuestion_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { ctx.Question.Add(new Question { QuestionTitle = txtAddQuestion.Text }); ctx.SaveChanges(); dgvQuestions.DataSource = ctx.Question.ToList(); } }
private void TxtAddQuestion_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { string question = txtAddQuestion.Text.Trim(); if (string.IsNullOrWhiteSpace(question)) { MessageBox.Show("Soru girmediniz!"); return; } ctx.Question.Add(new Question { QuestionTitle = txtAddQuestion.Text }); ctx.SaveChanges(); ListQuestions(); } }
private void BtnAddProject_Click(object sender, EventArgs e) { try { MessageBox.Show("Kaydedildi"); var report = new Models.Report { ReportDescription = txtReportDescription.Text, EmployeeFK = (long)cboEmplooyeFK.SelectedValue }; ctx.Report.Add(report); } catch (Exception ex) { MessageBox.Show("Kayıt işlemi başarısız"); } ctx.SaveChanges(); }
private void Button1_Click(object sender, EventArgs e) { ctx.SaveChanges(); MessageBox.Show("Kaydedildi"); SaveAndGetQuestions(); }