public ActionResult CategoryDelete(Category category) { var categoryService = new CategoryLogic(); categoryService.DeleteCategory(category.CategoryId); return(RedirectToAction("Categories")); }
private void DeleteCategory(object sender, RoutedEventArgs e) { var element = (FrameworkElement)sender; var category = element.DataContext as Category; if (category == null) { return; } CategoryLogic.DeleteCategory(category); }
public void DeleteCategory_Test() { Assert.AreEqual(3, _categoryLogic.GetAllCategories().Count); _categoryLogic.DeleteCategory(1); Assert.AreEqual(2, _categoryLogic.GetAllCategories().Count); }