Example #1
0
        public string PingLunTiTiao()
        {
            try
            {
                string text = Request["text"];
                text = text.Replace("<", "&lt;");
                text = text.Replace(">", "&gt;");
                int          cid       = Convert.ToInt32(Request["cid"]);
                int          pageIndex = Convert.ToInt32(Request["pageIndex"] ?? "1");
                int          pageSize  = Convert.ToInt32(Request["pageSize"] ?? "5");
                SessionInfo  user      = Session["sessionInfo"] as SessionInfo;
                ContentBLL   bll       = new ContentBLL();
                CommentModel model     = new CommentModel()
                {
                    ContentId = cid,
                    Text      = text,
                    Time      = DateTime.Now,
                    UserId    = user.userModel.Id,
                    ZhiChi    = 0,
                    FanDui    = 0
                };
                int res = bll.PingLunTiTiao(model);
                if (res > 1)
                {
                    UserBLL ubll = new UserBLL();

                    ContentPageModel <CommentModel> list = ubll.GetComment(cid, pageIndex, pageSize);
                    list.pageThis = pageIndex;
                    return("success:" + JsonConvert.SerializeObject(list).ToString());
                }
                return("failure:评论失败....");
            }
            catch (Exception ex)
            {
                Log.WriteFile(ex);
                return("failure:评论出错....");
            }
        }