Example #1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int         id  = int.Parse(context.Request["id"]);
            string      msg = context.Request["content"];
            CommentInfo ci  = new CommentInfo();

            ci.BookId      = id;
            ci.CoomentMsg  = msg;
            ci.CommentTime = DateTime.Now;
            BookShopBLL.CoomentBLL bll = new CoomentBLL();
            if (bll.InsertCommentList(ci))
            {
                context.Response.Write(1);
            }
            else
            {
                context.Response.Write(0);
            }
        }
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int id = int.Parse(context.Request["id"]);

            BookShopBLL.CoomentBLL bll = new CoomentBLL();
            DataTable dt = bll.GetCommentListByBookId(id);
            List <CommentShowModel> list = new List <CommentShowModel>();

            foreach (DataRow dr in dt.Rows)
            {
                string temp = DateTime.Now.ToString("yyyy-MM-dd");
                list.Add(new CommentShowModel()
                {
                    CTime = temp,
                    CMsg  = dr["CommentMsg"].ToString()
                });
            }

            JavaScriptSerializer js = new JavaScriptSerializer();
            string result           = js.Serialize(list);

            context.Response.Write(result);
        }