Exemple #1
0
        //[Login]
        //评论
        public ActionResult Coms(Comments newsCom)
        {
            int    aid      = Convert.ToInt32(Session["aid"]);
            int    userid   = Convert.ToInt32(Session["UserID"]);
            string textarea = Request["pingluntextarea"];

            if (ModelState.IsValid)
            {
                if (textarea != "")
                {
                    newsCom.UserID = userid;
                    //新闻ID
                    newsCom.ThemeID = aid;
                    newsCom.ComTime = System.DateTime.Now;
                    //评论内容
                    newsCom.ComContent = textarea;
                    //增加评论
                    newsd.AddNewsCom(newsCom);
                }
                else
                {
                    return(Content("<script>alert('评论不能为空!');history.go(-1)</script>"));
                }
            }
            return(RedirectToAction("ArticleDetails", "ArticleShow", new { id = aid }));
        }