public bool DeleteFromDb() { DialogResult dialogResult = MessageBox.Show("Do you want to delete this worker?", "Warning", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); if (dialogResult != DialogResult.OK) { return(false); } else { if (UserRequests.DeleteUser((radGridView1.CurrentRow.Tag as User).UserId)) { return(true); } else { return(false); } } }
private void btn_delete_Click(object sender, EventArgs e) { var confirmResult = MessageBox.Show("Are you sure to delete this item ??", "Confirm Delete!!", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { int id = (cmb_workers.SelectedItem as User).UserId; if (UserRequests.DeleteUser(id)) { MessageBox.Show("Deleted!"); } else { MessageBox.Show("Did not succeed to "); } updateForm(); } }