Esempio n. 1
0
        private void AddComment(HttpContext context)
        {
            string comments = context.Request.Params["comments"];
            int    id       = int.Parse(context.Request.Params["id"]);

            Data.dbml.Comments c = new Data.dbml.Comments();
            c.Comment = comments;
            c.BoardsImagesMappingID = id;
            c.UserID = Common.UserID.Value;
            Data.dbml.AppUsers user = this.GetDataContext2.AppUsers.Single(o => o.ID == Common.UserID);
            this.GetDataContext2.Comments.InsertOnSubmit(c);
            this.GetDataContext2.SubmitChanges();
            context.WriteJsonP(JsonConvert.SerializeObject(new
            {
                Comment = comments,
                Name    = user.FirstName,
                Avatar  = user.Avatar,
                UN      = user.Name
            }));
        }
Esempio n. 2
0
 private void AddComment(HttpContext context)
 {
     string comments = context.Request.Params["comments"];
     int id = int.Parse(context.Request.Params["id"]);
     Data.dbml.Comments c = new Data.dbml.Comments();
     c.Comment = comments;
     c.BoardsImagesMappingID = id;
     c.UserID = Common.UserID.Value;
     Data.dbml.AppUsers user = this.GetDataContext2.AppUsers.Single(o => o.ID == Common.UserID);
     this.GetDataContext2.Comments.InsertOnSubmit(c);
     this.GetDataContext2.SubmitChanges();
     context.WriteJsonP(JsonConvert.SerializeObject(new
     {
         Comment = comments,
         Name = user.FirstName,
         Avatar = user.Avatar,
         UN = user.Name
     }));
 }