public ReviewCommentDataDTO MapToReviewCommentDataDTO(ReviewCommentEntity source, ReviewCommentDataDTO target = null) { if (source == null) { return(null); } if (target == null) { target = new ReviewCommentDataDTO(); } MapToCommentDataDTO(source, target); target.Review = MapToReviewInfoDTO(source.Review); target.CommentReviewVotes = source.CommentReviewVotes.Select(x => MapToReviewVoteDataDTO(x)).ToArray(); return(target); }
public ReviewCommentEntity MapToReviewCommentEntity(ReviewCommentDataDTO source, ReviewCommentEntity target = null) { if (source == null) { return(null); } if (target == null) { target = GetReviewCommentEntity(source); } if (!MapToRevision(source, target)) { return(target); } MapToCommentBaseEntity(source, target); target.Review = GetReviewEntity(source.Review); if (target.CommentReviewVotes == null) { target.CommentReviewVotes = new List <CommentReviewVoteEntity>(); } MapCollection(source.CommentReviewVotes, target.CommentReviewVotes, MapToCommentReviewVoteEntity, x => x.Keys, removeFromCollection: true, removeFromDatabase: true); return(target); }
public ReviewCommentEntity MapToReviewCommentEntity(ReviewCommentDataDTO source, ReviewCommentEntity target = null) { if (source == null) { return(null); } if (target == null) { target = GetReviewCommentEntity(source); } if (!MapToRevision(source, target)) { return(target); } MapToCommentBaseEntity(source, target); //target.Review = GetReviewEntity(new IncidentReviewInfoDTO() { ReviewId = source.ReviewId }); target.Review = DefaultGet <IncidentReviewEntity>(source.ReviewId); if (target.CommentReviewVotes == null) { target.CommentReviewVotes = new List <CommentReviewVoteEntity>(); } MapCollection(source.CommentReviewVotes, target.CommentReviewVotes, MapToCommentReviewVoteEntity, x => x.Keys, removeFromCollection: true, removeFromDatabase: true, autoAddMissing: true); return(target); }