Ejemplo n.º 1
0
        public void CreateComment(PostDTOCassandra post, CommentDTOCassandra comment, string username)
        {
            var session = _cluster.Connect();


            var addComment = session.Prepare(
                "INSERT INTO comments (PostID, CommentID, Text, UserID) VALUES(?,?,?, ?)");

            session.Execute(addComment.Bind(comment.PostID, comment.CommentID, comment.Text, comment.UserID));

            var updatedPost = session.Prepare(
                "Update posts set Date=?  where PostID = ?");

            session.Execute(updatedPost.Bind(comment.CommentID, comment.PostID));



            _stream.SynchronizeStream(session, post);
        }
Ejemplo n.º 2
0
        public void GetComments(List <CommentDTOCassandra> comments, string PostID, ISession session, List <string> list)
        {
            comments = new List <CommentDTOCassandra>();
            var getComments = session.Prepare("Select * from comments where PostID = ? ");
            var Comments    = session.Execute(getComments.Bind(PostID));

            foreach (var comment1 in  Comments)
            {
                CommentDTOCassandra comment = new CommentDTOCassandra()
                {
                    CommentID = comment1.GetValue <string>("CommentID"),
                    PostID    = comment1.GetValue <string>("PostID"),
                    UserID    = comment1.GetValue <string>("UserID"),
                    Text      = comment1.GetValue <string>("Text"),
                    Date      = comment1.GetValue <DateTime>("Date")
                };

                comments.Add(comment);
            }
        }
Ejemplo n.º 3
0
 public void SyncronizeComment(PostDTOCassandra post, CommentDTOCassandra comment, string username)
 {
     _streamData.CreateComment(post, comment, username);
 }