private void DeleteUserButton_Click(object sender, RoutedEventArgs e) { var selectedItem = this.lvAuthorities.SelectedItem; if (selectedItem != null) { AuthorityEntity ent = selectedItem as AuthorityEntity; AuthorityService service = new AuthorityService(); if (MessageBox.Show("Sei sicuro di voler eliminare \"" + ent.AuthorityName + " \" ?", "Elimina Ente", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { if (service.Delete(ent) == 0) { MessageBox.Show("cancellato!"); this.RefreshData(); } else { MessageBox.Show("NON cancellato!"); } } else { MessageBox.Show("NON cancellato!"); } } }
public ActionResult DeleteConfirmed(int id) { Service.Delete(id); return(RedirectToAction("Index")); }