Inheritance: BaseObject
 public Comment Add(Comment comment)
 {
     using (var svc = new ServiceProxyHelper<ICommentsService>("CommentsService"))
     {
         return svc.Proxy.Add(comment);
     }
 }
Example #2
0
        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;
        }
Example #3
0
        public Comment Add(Comment comment)
        {
            try
            {
                var dbComment = CommentMapper.ToEntity(comment);
                dbComment.User = null;

                var dbResult = _commentRepository.Add(dbComment);
                dbResult.User = _userRepository.Find(a => a.UserId == comment.User.Id, false).FirstOrDefault();

                return CommentMapper.ToDto(dbResult);
            }
            catch (Exception ex)
            {
                throw new BlogException(ex.Message, ex.InnerException);
            }
        }
 public Comment Add(Comment comment, string authenticationToken)
 {
     throw new System.NotImplementedException();
 }