public IActionResult Delete(NewsArticleCategoryDeleteViewModel viewModel) { NewsArticleCategory category = newsArticleCategoryService.GetByID(viewModel.NewsArticleCategory.ID); if (category == null) { return(NotFound()); } newsArticleCategoryService.Delete(category.ID); return(RedirectToAction("Index")); }
public IActionResult Delete(int?id) { if (id == 0 || id == null) { return(NotFound()); } NewsArticleCategory category = newsArticleCategoryService.GetByID((int)id); if (category == null) { return(NotFound()); } NewsArticleCategoryDeleteViewModel viewModel = new NewsArticleCategoryDeleteViewModel { NewsArticleCategory = category }; return(View(viewModel)); }