Blog.Logic.ObjectMapper.CommentMapper.ToDto C# (CSharp) Method

ToDto() public static method

public static ToDto ( Blog.DataAccess.Database.Entities.Objects comment ) : Comment
comment Blog.DataAccess.Database.Entities.Objects
return Comment
        public static Comment ToDto(Db.Comment comment)
        {
            if (comment != null)
            {
                var commentLikes = comment.CommentLikes != null
                    ? comment.CommentLikes.Select(CommentLikeMapper.ToDto).ToList()
                    : null;
                var comments = comment.Comments != null
                    ? comment.Comments.Select(ToDto).ToList()
                    : null;

                return new Comment
                {
                    Id = comment.CommentId,
                    CommentLikes = commentLikes,
                    CommentLocation = comment.CommentLocation,
                    CommentMessage = comment.CommentMessage,
                    ParentCommentId = comment.ParentCommentId,
                    PostId = comment.PostId,
                    Comments = comments,
                    User = comment.User != null ? UserMapper.ToDto(comment.User) : null,
                    CreatedBy = comment.CreatedBy,
                    CreatedDate = comment.CreatedDate,
                    ModifiedBy = comment.ModifiedBy,
                    ModifiedDate = comment.ModifiedDate
                };
            }
            return null;
        }
CommentMapper