public IActionResult NewsDetail(int id) { if (id < 0) { return(RedirectToAction("Index", "Home")); } var news = _newsService.GetNews(id); if (news.Code == 0) { return(RedirectToAction("Index", "Home")); } ViewData["News"] = news; ViewData["Title"] = $"{news.Data.Title}-详情页"; var recommendNews = _newsService.GetRecommendNewsList(id); ViewData["RecommendNews"] = recommendNews; var newsCommens = _newsCommentService.GetNewCommentList(c => c.NewsId == id); ViewData["NewsComments"] = newsCommens; return(View(_newsService.GetNewsClassifyList())); }
// GET: Comment public IActionResult Index() { return(View(_newsCommentService.GetNewCommentList(c => true))); }