コード例 #1
0
        public IActionResult Delete(NewsArticleCategoryDeleteViewModel viewModel)
        {
            NewsArticleCategory category = newsArticleCategoryService.GetByID(viewModel.NewsArticleCategory.ID);

            if (category == null)
            {
                return(NotFound());
            }

            newsArticleCategoryService.Delete(category.ID);
            return(RedirectToAction("Index"));
        }
コード例 #2
0
        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));
        }