Exemplo n.º 1
0
        public IActionResult Delete(NewsArticleDeleteViewModel viewModel)
        {
            NewsArticle newsArticle = newsArticleService.GetByID(viewModel.NewsArticle.ID);

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

            newsArticleService.Delete(newsArticle.ID);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public IActionResult Delete(int id)
        {
            if (id == 0)
            {
                return(NotFound());
            }

            NewsArticle newsArticle = newsArticleService.GetByID(id);

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

            NewsArticleCategory category = newsArticleCategoryService.GetByID(id);

            NewsArticleDeleteViewModel viewModel = new NewsArticleDeleteViewModel
            {
                NewsArticle         = newsArticle,
                NewsArticleCategory = category ?? null
            };

            return(View(viewModel));
        }