Пример #1
0
        public IActionResult DeleteConfirmed(int id)
        {
            Exam exam = _examManager.Get(id);

            _examManager.Delete(exam);
            return(RedirectToAction(nameof(Index), new { message = "delete" }));
        }
 private void DeleteExam_Click(object sender, RoutedEventArgs e)
 {
     if (tbExaId.Text != "")
     {
         ExamManager examManager = new ExamManager();
         examManager.Delete("Exam", Convert.ToInt16(tbExaId.Text));
         //обновить
         lstExam.ItemsSource = examManager.GetExamModel();
     }
 }
Пример #3
0
        public void DeleteExam_Test()
        {
            _manager.Add(EXAM);

            IList <Exam> exams = _manager.GetAll().ToList();
            Exam         exam  = exams.First();

            _manager.Delete(exam);

            IList <Exam> deletedExams = _manager.GetAll().ToList();

            Assert.Equal(0, deletedExams.Count);
        }
Пример #4
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Are you sure to delete this record?",
                         "EF CRUD Operation", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         try
         {
             var id = Convert.ToInt32(txbExamID.Text);
             ExamManager.Delete(id);
             PopulateData(aExam.ExaminerID);
             Clear(this.Controls);
             MessageBox.Show("Delete Successfully!");
         }
         catch (Exception ex)
         {
             MessageBox.Show("Error when deleting the exam data: " + ex.Message,
                             ex.GetType().ToString());
             //this.DialogResult = DialogResult.Retry;
         }
     }
 }