public ActionResult Delete(int?Id) { if (Id != null) { var std = _StudentBLL.Delete(Id.Value); } return(RedirectToAction("Index")); }
private void MenuItem_OnClick(object sender, RoutedEventArgs e) { try { if (MessageBox.Show("Are you sure you want to delete this???????", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { if (DtgStudents.SelectedItem == null) { MessageBox.Show("You have not selected any item."); } var student = DtgStudents.SelectedItem as Student; _bll.Delete(student.Id); DtgStudents.ItemsSource = _bll.GetAll(); } } catch (Exception exception) { MessageBox.Show($"Could not delete the student. {exception.Message}"); } }
private void button4_Click(object sender, EventArgs e) { //Delete StudentBs student1 = new StudentBll(); student1.Delete(studentId.Text, studentName.Text, lastName.Text, birthDate.Text); }