private void buttonRemoveCats_Click(object sender, EventArgs e) { CategoryBusiness categoryBusiness = new CategoryBusiness(); int selectedCategoryId = (int)comboBoxSelectCat.SelectedValue; var selectedCategory = categoryBusiness.GetCategoryById(selectedCategoryId); string result = categoryBusiness.Remove(selectedCategory); MessageBox.Show(result); showCategories.ShowCategories(dataGridViewShowCats); }
public void Remove(int id) { try { var bc = new CategoryBusiness(); bc.Remove(id); } catch (Exception ex) { var httpError = new HttpResponseMessage { StatusCode = (HttpStatusCode)422, ReasonPhrase = ex.Message }; throw new HttpResponseException(httpError); } }
private void buttonRemoveCategory_Click(object sender, EventArgs e) { categoryBusiness.Remove(selectedCategory); getCategories(); }