private void cmdAdd_Click(object sender, EventArgs e) { CategoryDialog cDialog = new CategoryDialog(_categoryService, Operation.Add, null); cDialog.ShowDialog(); LoadCategories(); }
private void cmdEdit_Click(object sender, EventArgs e) { if (listBox1.SelectedItems.Count == 0) { MessageBox.Show("Please select category from the list!", "", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } Category selectedCategory = listBox1.SelectedItem as Category; CategoryDialog cDialog = new CategoryDialog(_categoryService, Operation.Edit, selectedCategory); cDialog.ShowDialog(); LoadCategories(); }