public async Task <IActionResult> Delete(string id) { var category = await _categoryService.GetCategoryById(id); if (category == null) { //No category found with the specified id return(RedirectToAction("List")); } if (_workContext.CurrentCustomer.IsStaff()) { if (!category.AccessToEntityByStore(_workContext.CurrentCustomer.StaffStoreId)) { return(RedirectToAction("Edit", new { id = category.Id })); } } if (ModelState.IsValid) { await _categoryViewModelService.DeleteCategory(category); SuccessNotification(_localizationService.GetResource("Admin.Catalog.Categories.Deleted")); } return(RedirectToAction("List")); }
public IActionResult Delete(string id) { var category = _categoryService.GetCategoryById(id); if (category == null) { //No category found with the specified id return(RedirectToAction("List")); } if (ModelState.IsValid) { _categoryViewModelService.DeleteCategory(category); SuccessNotification(_localizationService.GetResource("Admin.Catalog.Categories.Deleted")); } return(RedirectToAction("List")); }
public ActionResult Delete(int categoryId) { _categoryService.DeleteCategory(categoryId); return(View("Index", _categoryService.GetCategories(null).Result)); }