public ActionResult Wall(string commentText)
 {
     Comment newComment = new Comment();
     newComment.email = Session["email"].ToString();
     newComment.comment = commentText;
     newComment.dateTime = DateTime.Now;
     CommentService.InsertComment(newComment);
     return RedirectToAction("Wall", "Comments");
 }
Example #2
0
        public static void InsertComment(Comment comment)
        {
            MongoDatabase db = DBConnection.Db();
            if (!db.CollectionExists("comments"))
                db.CreateCollection("comments");
            var comments = db.GetCollection("comments");

            var commentObject = new BsonDocument();
            commentObject["email"] = comment.email;
            commentObject["comment"] = comment.comment;
            commentObject["dateTime"] = DateTime.Now;
            comments.Insert(commentObject);
        }