Blog.Logic.Core.CommentsLogic.Add C# (CSharp) Method

Add() public method

public Add ( Comment comment ) : Comment
comment Blog.Common.Contracts.Comment
return Blog.Common.Contracts.Comment
        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);
            }
        }