public CommentInfoDTO MapToCommentInfoDTO(CommentBaseEntity source, CommentInfoDTO target = null) { if (source == null) { return(null); } if (target == null) { target = new CommentInfoDTO(); } MapToVersionInfoDTO(source, target); target.CommentId = source.CommentId; target.AuthorUserId = source.AuthorUserId; target.AuthorName = source.AuthorName; return(target); }
public CommentBaseEntity GetCommentEntity(CommentInfoDTO source) { //if (source == null) // return null; //CommentBaseEntity target; //if (source is ReviewCommentDataDTO reviewComment) // target = GetReviewCommentEntity(reviewComment); //else if (source.CommentId == null) // target = new CommentBaseEntity(); //else // target = DbContext.Set<CommentBaseEntity>().Find(source.CommentId); //if (target == null) // throw new EntityNotFoundException(nameof(CommentBaseEntity), "Could not find Entity in Database.", source.CommentId); //return target; return(DefaultGet <CommentInfoDTO, CommentBaseEntity>(source)); }