public CommentBaseEntity MapToCommentBaseEntity(CommentDataDTO source, CommentBaseEntity target = null) { if (source == null) { return(null); } if (target == null) { target = GetCommentEntity(source); } if (!MapToRevision(source, target)) { return(target); } //target.Author = GetMemberEntity(source.Author); target.AuthorUserId = source.AuthorUserId; target.AuthorName = source.AuthorName; target.Date = source.Date; target.Text = source.Text; target.ReplyTo = GetCommentEntity(source.ReplyTo); if (target.Replies == null) { target.Replies = new List <CommentBaseEntity>(); } MapCollection(source.Replies, target.Replies, MapToCommentBaseEntity, x => x.Keys); return(target); }
public CommentDataDTO MapToCommentDataDTO(CommentBaseEntity source, CommentDataDTO target = null) { if (source == null) { return(null); } if (target == null) { target = new CommentDataDTO(); } MapToCommentInfoDTO(source, target); //target.Author = MapToMemberInfoDTO(source.Author); target.AuthorName = source.AuthorName; target.Date = source.Date; target.Text = source.Text; target.ReplyTo = MapToCommentInfoDTO(source.ReplyTo); target.Replies = source.Replies.Select(x => MapToCommentDataDTO(x)).ToArray(); return(target); }