예제 #1
0
        /// <summary>
        /// 新闻类别页面
        /// </summary>
        /// <param name="id">类别ID</param>
        /// <returns></returns>
        public IActionResult Classify(int id)
        {
            ViewData["Title"] = "分类页";
            if (id <= 0)
            {
                Response.Redirect("/Home/Index");
            }
            NewsClassify newsClassify = newsClassifyServices.GetbyId(id);

            ViewData["ClassifyName"]   = "分类页";
            ViewData["NewsList"]       = new ResponseModel();
            ViewData["NewCommentNews"] = new ResponseModel();
            if (newsClassify != null)
            {
                ViewData["ClassifyName"] = newsClassify.Name;
                ViewData["Title"]        = newsClassify.Name;
                ViewData["NewsList"]     = newsServices.GetNewsByClassifyId(id);
            }
            else
            {
                Response.Redirect("/Home/Index");
            }
            //页面头部类别显示
            List <NewsClassify> list = newsClassifyServices.GetAllOrderBySort();

            return(View(list));
        }