コード例 #1
0
        //发表帖子

        public ActionResult PostDetail(int id)
        {
            var       sdew      = PostManage.selectpost(id);
            var       postef1   = PostManage.selectallpost().OrderByDescending(p => p.Post_Click).Skip(6).Take(5);
            var       buser     = sdew.User_id;
            var       userid    = Convert.ToInt32(Session["User_id"]);
            var       commdpost = PostManage.findallcomment(id);
            int       attef;
            ForumPost indew = new ForumPost();

            if (userid > 0)
            {
                var atter = AttentionManage.selecatten(userid, buser);
                if (atter != null)
                {
                    attef = 1;
                    ViewBag.attenrenid = atter.Attention_id;
                }
                else
                {
                    attef = 0;
                }
                var userinfo1 = UsersManage.finduser(userid);
                indew.Userinfo2 = userinfo1;
            }
            else
            {
                attef = 0;
            }
            ViewBag.atterceshi = attef;
            indew.Post7        = postef1;
            indew.Post5        = sdew;
            indew.Commentpost  = commdpost;
            return(View(indew));
        }