private void BTN_MIDelete_Click(object sender, EventArgs e) { if (this.selectedMenuItem == null) { MessageBox.Show("Select an item!"); return; } menuItemService.DeleteMenuItem(this.selectedMenuItem.Id); MessageBox.Show("MenuItem Gedelete", "MenuItem!", MessageBoxButtons.OK); displayGrid(); }
//remove button private void RemoveBtn_Click(object sender, EventArgs e) { if (listRemoveMenuItem.SelectedItems.Count < 1) { MessageBox.Show("Please pick a menu item to remove from system.", "Missing information", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { //get's the id from combo box by splitting it. ChapeauModel.MenuItem ChosenMenuItem = (ChapeauModel.MenuItem)listRemoveMenuItem.SelectedItems[0].Tag; if (MessageBox.Show($"Are you sure you want to delete {ChosenMenuItem.Name} ", "Verification", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { serviceItem.DeleteMenuItem(ChosenMenuItem); MessageBox.Show("Employee has been removed.", "Employee removed", MessageBoxButtons.OK, MessageBoxIcon.Information); FillMenuItemListView(listRemoveMenuItem); } } }
private void BtnYes_Click(object sender, EventArgs e) { menuItemService.DeleteMenuItem(item.Id); Close(); }