/// <summary> /// 新闻详细页面 /// </summary> /// <param name="id">新闻Id</param> /// <returns>View页面</returns> public IActionResult Detail(int id) { ViewData["Title"] = "详情页"; if (id <= 0) { Response.Redirect("/Home/Index"); } News news = newsServices.GetbyId(id); ViewData["News"] = new ResponseModel(); ViewData["RecommendNews"] = new ResponseModel(); ViewData["Comments"] = new ResponseModel(); if (news != null) { ViewData["Title"] = news.Title + " -详情页"; ViewData["News"] = news; ViewData["NewsConunt"] = newsServices.GetNewsConunt(); ViewData["NewsCommnetCount"] = newsCommentServices.GetCommentCountByNewsId(id); ViewData["NewsClassify"] = newsClassifyServices.GetClassifyName(Convert.ToInt32(news.NewsClassifyId)); ViewData["Comments"] = newsCommentServices.GetCommentByNewsId(news.Id); } else { Response.Redirect("/Home/Index"); } //页面头部类别显示 List <NewsClassify> list = newsClassifyServices.GetAllOrderBySort(); return(View(list)); }