コード例 #1
0
        public ActionResult JunBa(int id, string search_internal_input)
        {
            var sdedw    = PostManage.findforumsec(id);
            var userid   = Convert.ToInt32(Session["user_id"]);
            var forupost = PostManage.selectzhepost(id);
            var userinfo = UsersManage.finduser(userid);
            var postef   = PostManage.selectallpost().OrderByDescending(p => p.Post_Click).Take(5);

            if (!String.IsNullOrEmpty(search_internal_input))
            {
                forupost = forupost.Where(s => s.PostName.Contains(search_internal_input) || s.PostContent.Contains(search_internal_input));
            }

            int attentionposet;
            int signtrue;
            int attenid;

            if (userid > 0)
            {
                var sdedq   = AttentionManage.selectattenpostforu(userid, id);
                var sdedfdf = AttentionManage.findsign(userid, id);
                if (sdedq != null)
                {
                    attenid             = sdedq.AttentionPost_id;
                    ViewBag.attentionid = attenid;
                    attentionposet      = 1;
                }
                else
                {
                    attentionposet = 0;
                }
                if (sdedfdf != null)
                {
                    signtrue         = 1;
                    ViewBag.signtime = sdedfdf.SignatureTime;
                }
                else
                {
                    signtrue = 0;
                }
            }
            else
            {
                attentionposet = 0;
                signtrue       = 0;
            }
            ViewBag.atten      = attentionposet;
            ViewBag.signid     = signtrue;
            ViewBag.allcontgun = AttentionManage.findattenjisuan(id);
            ViewBag.postcount  = AttentionManage.findallpost(id);
            ForumPost idnes = new ForumPost();

            idnes.ForumSEC1 = sdedw;
            idnes.Post1     = forupost;
            idnes.Post2     = postef;
            if (userinfo != null)
            {
                idnes.Userinfo1 = userinfo;
            }

            return(View(idnes));
        }