Example #1
0
        /// <summary>
        /// 获取评论的数据
        /// 页面:Home
        /// </summary>
        /// <returns></returns>
        public ActionResult AjaxGetCommentData()
        {
            int                      postId                = Convert.ToInt32(Request["postId"]);
            int                      postType              = Convert.ToInt32(Request["postType"]);
            PostComment_bll          postComment_bll       = new PostComment_bll();
            List <PostComment_model> postComment_modelList = postComment_bll.GetPostComment(postId, postType);
            JavaScriptSerializer     serializer            = new JavaScriptSerializer();
            string                   jsonData              = serializer.Serialize(postComment_modelList);

            return(Content(jsonData));
        }
Example #2
0
        /// <summary>
        /// 实现帖子的评论功能,将数据保存到数据库
        /// 帖子类型为1代表主贴的评论
        /// 帖子类型为2代表回帖的评论
        /// </summary>
        /// <returns></returns>
        public ActionResult AjaxTieZiComment()
        {
            int             postId              = Convert.ToInt32(Request["postId"]);
            string          commentUserName     = Request["commenterUserName"].ToString();
            User_bll        user_bll            = new User_bll();
            int             commenterId         = user_bll.GetUserId(commentUserName);
            string          beCommenterUserName = Request["beCommenterUserName"];
            int             beCommenterId       = user_bll.GetUserId(beCommenterUserName);
            string          content             = Request["content"].ToString();
            int             postType            = Convert.ToInt32(Request["postType"]);
            DateTime        datetime            = DateTime.Now;
            PostComment_bll postComment_bll     = new PostComment_bll();
            int             InsertCount         = postComment_bll.InsertComment(postId, commenterId, beCommenterId, content, datetime, postType);//插入评论数据的成功条数

            return(Content(InsertCount.ToString()));
        }