public string UpdateComment(DataCommentModel comment) { try { neo4j.UpdateComment(comment.commentid, comment.text); return("OK"); } catch (Exception ex) { return(ex.Message); } }
public Comment UploadComment([FromBody] DataCommentModel comment) { try { Post post = new Post { id = new Guid(comment.postId) }; User user = new User { username = User.Identity.GetUserName() }; Comment newComment = new Comment { text = comment.text, creator = user, time = DateTime.Now.ToString() }; redis.PushLatestActivity(user.username, "You commented post: " + comment.postId); if (neo4j.CreateCommentRelationships(new HasComment { comment = newComment, post = post, time = DateTime.Now.ToString() }, new Commented { comment = newComment, commentator = user, time = DateTime.Now.ToString() })) { return(newComment); } else { return(null); } } catch (Exception) { return(null); } }