public Comment Add(Comment comment)
{
var postId = comment.PostId;
if (comment.ParentCommentId != null)
{
comment.PostId = null;
}
var result = _commentsLogic.Add(comment);
if (result != null && result.Error != null) throw new Exception(result.Error.Message);
var commentAdded = new CommentAdded
{
CommentId = comment.ParentCommentId,
PostId = postId,
Comment = result,
ClientFunction = Constants.SocketClientFunctions.CommentAdded.ToString()
};
_redisService.Publish(commentAdded);
return result;
}