public ScoredResultDataDTO MapToScoredResultDataDTO(ScoredResultEntity source, ScoredResultDataDTO target = null) { if (source == null) { return(null); } if (target == null) { target = new ScoredResultDataDTO(); } MapToResultInfoDTO(source.Result, target); target.Scoring = MapToScoringInfoDTO(source.Scoring); target.ScoringName = source.Scoring.Name; target.FinalResults = source.FinalResults.Select(x => MapToScoredResultRowDataDTO(x)).OrderBy(x => x.FinalPosition).ToList(); return(target); }
public ScoredResultDataDTO MapToScoredResultDataDTO(ScoredResultEntity source, ScoredResultDataDTO target = null) { if (source == null) { return(null); } if (target == null) { target = new ScoredResultDataDTO(); } MapToResultInfoDTO(source.Result, target); target.ScoringId = source.ScoringId; // MapToScoringInfoDTO(source.Scoring); target.ScoringName = source.Scoring.Name; target.FinalResults = source.FinalResults?.Select(x => MapToScoredResultRowDataDTO(x)).OrderBy(x => x.FinalPosition).ToArray(); target.CleanesDriverMemberIds = source.CleanestDrivers?.Select(x => x.MemberId).ToArray() ?? new long[0]; target.HardChargerMemberIds = source.HardChargers?.Select(x => x.MemberId).ToArray() ?? new long[0]; target.FastestLapDriverId = source.FastestLapDriver?.MemberId; target.FastestQualyLapDriver = source.FastestQualyLapDriver?.MemberId; target.FastestAvgLapDriver = source.FastestAvgLapDriver?.MemberId; return(target); }