public void AddCommentOnPost(CommentOnPost c) { string postKey = KeysDictionary.PostKey(c.Post.Id); string serializedComment = ObjectSerializer.SerializeComment(c); redis.PushItemToList(postKey, serializedComment); }
public void AddCommentOnPost(CommentOnPost comment) { client.Cypher .Match("(p:Post),(u:User)") .Where((Post p) => p.Id == comment.Post.Id) .AndWhere((User u) => u.Username == comment.User.Username) .Create("(p)<-[:COMMENT_ON]-(c:Comment{Id:'" + comment.Id + "',Text:'" + comment.Text + "',TimePosted:'" + comment.TimePosted + "'})<-[:COMMENTED]-(u)") .ExecuteWithoutResults(); }
public IActionResult CreateComment(CommentOnPost comment) { Comment newComment = new Comment(); newComment.CommentId = comment.CommentId; newComment.UserName = comment.UserName; newComment.Content = comment.Content; newComment.PostId = comment.CurrentPostId; _db.Comments.Add(newComment); _db.SaveChanges(); return(RedirectToAction("Details", "Blog", new { id = comment.CurrentPostId })); }
public IActionResult CreateComment(int id) { CommentOnPost commentonpost = new CommentOnPost(id); return(View(commentonpost)); }
public static string SerializeComment(CommentOnPost comment) { return(JsonSerializer.SerializeToString <CommentOnPost>(comment)); }