public IActionResult Details(int id) { if (id == 0) { return(NotFound()); } NewsArticle newsArticle = newsArticleService.GetByID(id); if (newsArticle == null) { return(NotFound()); } NewsArticleCategory category = newsArticleCategoryService.GetByID(newsArticle.CategoryID); NewsArticleDetailsViewModel viewModel = new NewsArticleDetailsViewModel { NewsArticle = newsArticle, NewsArticleCategory = category ?? null }; return(View(viewModel)); }