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); } }
partial void UpdatePostComment(PostComment instance);
partial void DeletePostComment(PostComment instance);
partial void InsertPostComment(PostComment instance);