Example #1
0
        public ActionResult Add(int id = 0)
        {
            ViewBag.UserName = LoginUser.uRealName;
            Topic Topic = new Topic();

            if (id > 0)
            {
                Topic = TopicServive.QueryWhere(a => a.Id == id).FirstOrDefault();
            }
            return(View(Topic));
        }
        /// <summary>
        /// 详情页
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Detail(int id = 0)
        {
            //获取控制器名称
            ViewBag.controllername = RouteData.Values["controller"].ToString().ToLower();
            int pagesize        = 6;
            var blogArticleList = TopicServive.QueryWhere(a => !a.tIsDelete && a.Id == id).FirstOrDefault();

            foreach (var item in blogArticleList.TopicDetail)
            {
                if (!string.IsNullOrEmpty(item.tdContent))
                {
                    item.tdContent = Tools.ReplaceHtmlTag(item.tdContent);
                    if (item.tdContent.Length > 200)
                    {
                        item.tdContent = item.tdContent.Substring(0, 200);
                    }
                }
            }
            return(View(blogArticleList.TopicDetail.OrderByDescending(b => b.tdTop).ThenByDescending(c => c.Id).ToList()));
        }