Ejemplo n.º 1
0
        // todo: ajax this
        protected void btnSave_Click(object sender, EventArgs e)
        {
            var b       = sender as Button;
            var g       = new Guid(b.CommandArgument);
            var context = CommentDb.Load();

            context.Comments.First(x => x.ID.Equals(g)).Text = (b.Parent.FindControl("txtText") as TextBox).Text;
            CommentDb.Save(context);
        }
Ejemplo n.º 2
0
        // todo: ajax this
        protected void btnDelete_Click(object sender, EventArgs e)
        {
            var b       = sender as Button;
            var g       = new Guid(b.CommandArgument);
            var context = CommentDb.Load();

            context.Comments            = context.Comments.Where(c => !c.ID.Equals(g)).ToArray();
            context.SerializedHighlight = hdnForHighlighter.Value;
            CommentDb.Save(context);
            BindComments();
        }
Ejemplo n.º 3
0
        // todo: ajax this
        protected void btnAddComment_Click(object sender, EventArgs e)
        {
            var context  = CommentDb.Load();
            var comments = context.Comments.ToList();

            comments.Add(new Comment {
                ID = Guid.NewGuid(), UserName = User.Identity.Name, SerializedSelection = hdnForAdd.Value
            });
            context.Comments            = comments.ToArray();
            context.SerializedHighlight = hdnForHighlighter.Value;
            CommentDb.Save(context);
            BindComments();
        }