public StandingsRowDataDTO MapToStandingsRowDataDTO(StandingsRowEntity source, StandingsRowDataDTO target = null) { if (source == null) { return(null); } if (target == null) { target = new StandingsRowDataDTO(); } target.CarClass = source.CarClass; target.ClassId = source.ClassId; target.CompletedLaps = source.CompletedLaps; target.CompletedLapsChange = source.CompletedLapsChange; target.DroppedResultCount = source.DroppedResultCount; target.FastestLaps = source.FastestLaps; target.FastestLapsChange = source.FastestLapsChange; target.Incidents = source.Incidents; target.IncidentsChange = source.IncidentsChange; target.LastPosition = source.LastPosition; target.LeadLaps = source.LeadLaps; target.LeadLapsChange = source.LeadLapsChange; target.MemberId = source.Member.MemberId; // MapToMemberInfoDTO(source.Member); target.PenaltyPoints = source.PenaltyPoints; target.PenaltyPointsChange = source.PenaltyPointsChange; target.PolePositions = source.PolePositions; target.PolePositionsChange = source.PolePositionsChange; target.Position = source.Position; target.PositionChange = source.PositionChange; target.RacePoints = source.RacePoints; target.RacePointsChange = source.RacePointsChange; target.Races = source.Races; target.RacesCounted = source.RacesCounted; //target.ScoringId = source.Scoring.ScoringId; // MapToScoringInfoDTO(source.Scoring); target.Top10 = source.Top10; target.Top3 = source.Top3; target.Top5 = source.Top5; target.TotalPoints = source.TotalPoints; target.TotalPointsChange = source.TotalPointsChange; target.Wins = source.Wins; target.WinsChange = source.WinsChange; var countedResults = source.CountedResults?.Select(x => MapToScoredResultRowDataDTO(x)).ToArray(); var droppedResults = source.DroppedResults?.Select(x => MapToScoredResultRowDataDTO(x)).ToArray(); countedResults.ForEach(x => x.IsDroppedResult = false); droppedResults.ForEach(x => x.IsDroppedResult = true); target.DriverResults = countedResults.Concat(droppedResults).OrderBy(x => x.Date).ToArray(); target.TeamId = source.Team?.TeamId; return(target); }
public StandingsRowDataDTO MapToStandingsRowDataDTO(StandingsRowEntity source, StandingsRowDataDTO target = null) { if (source == null) { return(null); } if (target == null) { target = new StandingsRowDataDTO(); } target.CarClass = source.CarClass; target.ClassId = source.ClassId; target.CompletedLaps = source.CompletedLaps; target.CompletedLapsChange = source.CompletedLapsChange; target.DroppedResults = source.DroppedResults; target.FastestLaps = source.FastestLaps; target.FastestLapsChange = source.FastestLapsChange; target.Incidents = source.Incidents; target.IncidentsChange = source.IncidentsChange; target.LastPosition = source.LastPosition; target.LeadLaps = source.LeadLaps; target.LeadLapsChange = source.LeadLapsChange; target.Member = MapToMemberInfoDTO(source.Member); target.PenaltyPoints = source.PenaltyPoints; target.PenaltyPointsChange = source.PenaltyPointsChange; target.PolePositions = source.PolePositions; target.PolePositionsChange = source.PolePositionsChange; target.Position = source.Position; target.PositionChange = source.PositionChange; target.RacePoints = source.RacePoints; target.RacePointsChange = source.RacePointsChange; target.Races = source.Races; target.RacesCounted = source.RacesCounted; target.Scoring = MapToScoringInfoDTO(source.Scoring); target.Top10 = source.Top10; target.Top3 = source.Top3; target.Top5 = source.Top5; target.TotalPoints = source.TotalPoints; target.TotalPointsChange = source.TotalPointsChange; target.Wins = source.Wins; target.WinsChange = source.WinsChange; return(target); }