public StandingsDataDTO MapToStandingsDataDTO(StandingsEntity source, StandingsDataDTO target = null) { if (source == null) { return(null); } if (target == null) { target = new StandingsDataDTO(); } target.CleanestDriver = MapToMemberInfoDTO(source.CleanestDriver); target.MostPenaltiesDriver = MapToMemberInfoDTO(source.MostPenaltiesDriver); target.MostPolesDriver = MapToMemberInfoDTO(source.MostPolesDriver); target.MostWinsDriver = MapToMemberInfoDTO(source.MostWinsDriver); target.Scoring = MapToScoringInfoDTO(source.Scoring); target.ScoringTableId = source.ScoringTable.ScoringTableId; target.StandingsRows = source.StandingsRows.Select(x => MapToStandingsRowDataDTO(x)).ToArray(); return(target); }
public StandingsDataDTO MapToStandingsDataDTO(StandingsEntity source, StandingsDataDTO target = null) { if (source == null) { return(null); } if (target == null) { target = new StandingsDataDTO(); } target.CleanestDriverId = source.CleanestDriver?.MemberId; // MapToMemberInfoDTO(source.CleanestDriver); target.MostPenaltiesDriverId = source.MostPenaltiesDriver?.MemberId; // MapToMemberInfoDTO(source.MostPenaltiesDriver); target.MostPolesDriverId = source.MostPolesDriver?.MemberId; // MapToMemberInfoDTO(source.MostPolesDriver); target.MostWinsDriverId = source.MostWinsDriver?.MemberId; // MapToMemberInfoDTO(source.MostWinsDriver); target.ScoringId = (source.Scoring?.ScoringId).GetValueOrDefault(); // MapToScoringInfoDTO(source.Scoring); target.ScoringTableId = source.ScoringTable.ScoringTableId; target.StandingsRows = source.StandingsRows.Select(x => MapToStandingsRowDataDTO(x)).ToArray(); target.SessionId = source.SessionId; target.Name = source.ScoringTable.Name; return(target); }