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); }
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); } }
public void SyncronizeComment(PostDTOCassandra post, CommentDTOCassandra comment, string username) { _streamData.CreateComment(post, comment, username); }