Пример #1
0
        private void deleteButton_Click(object sender, EventArgs e)
        {
            var collection = database.GetCollection <BsonDocument>("comments");
            var builder    = Builders <BsonDocument> .Filter;
            var filter     = builder.Eq("_id", ObjectId.Parse(commentId));
            var result     = collection.DeleteOne(filter);

            ParentForm.Hide();
            comment com = new comment(postId);

            com.Show();
        }
Пример #2
0
        private void addButton_Click(object sender, EventArgs e)
        {
            var collection = database.GetCollection <BsonDocument>("comments");
            var comment    = new BsonDocument
            {
                { "userId", User.id },
                { "description", descriptionText.Text },
                { "date_created", DateTime.Today.ToString("dd/MM/yyyy") },
                { "time_created", DateTime.Now.ToString("HH:mm:ss tt") },
                { "posted_by", User.firstName + " " + User.lastName },
                { "post_id", postId },
            };

            collection.InsertOne(comment);
            comment com = new comment(postId);

            this.Hide();
            com.Show();
        }
Пример #3
0
        private void commentButton_Click(object sender, EventArgs e)
        {
            comment com = new comment(postId);

            com.Show();
        }