private void Test() { Post p1 = new Post() { Date = DateTime.Now, Description = "desc", Domain = "Domain" }; Post p2 = new Post() { Date = DateTime.Now, Description = "Description", Domain = "domeniu" }; PostCommentClient postCommentClient = new PostCommentClient(); postCommentClient.AddPost(p1); postCommentClient.AddPost(p2); postCommentClient.AddComment(new Comment() { PostPostId = 1, Text = "very nice comment" }); postCommentClient.AddComment(new Comment() { PostPostId = 1, Text = "Very mean comment" }); postCommentClient.AddComment(new Comment() { PostPostId = 2, Text = "random comment" }); }
private void buttonAddComment_Click(object sender, EventArgs e) { if (selectedPostIndex < 0) { return; } PostCommentClient pc = new PostCommentClient(); Post selectedPost = posts[selectedPostIndex]; Comment comment = new Comment() { Text = textBoxComment.Text, PostPostId = selectedPost.PostId }; pc.AddComment(comment); RefreshPosts(); RefreshComments(selectedPostIndex); }