Exemplo n.º 1
0
        protected void btnCommentSubmit_Click(object sender, EventArgs e)
        {
            VsrDataContext db = new VsrDataContext();
            Guid postid = Guid.Empty;

            if (Request.QueryString["post"] == null)
            {
                Response.Redirect("Default.aspx");
            }
            else
            {
                postid = new Guid(Request.QueryString["post"].ToString());
                if(!DoesPostIdExist(postid))
                    Response.Redirect("Default.aspx");
            }


            if (txtComment.Text.ToString().Length > 3 && txtUsername.Text.ToString().Length > 3)
            {
                PostComment p = new PostComment();
                p.comment_id = Guid.NewGuid();
                p.posts_id = postid;
                p.post_date = DateTime.Now;
                p.praise_count = 0;
                p.criticism_count = 0;
                p.source_ip = Request.ServerVariables["REMOTE_ADDR"];
                p.username = txtUsername.Text.ToString();
                p.posttext = txtComment.Text.ToString();

                db.PostComments.InsertOnSubmit(p);
                db.SubmitChanges();

                txtComment.Text = "";
                txtUsername.Text = "";

                PopulateComments(postid);

            }
        }
Exemplo n.º 2
0
 partial void UpdatePostComment(PostComment instance);
Exemplo n.º 3
0
 partial void DeletePostComment(PostComment instance);
Exemplo n.º 4
0
 partial void InsertPostComment(PostComment instance);