public ResultRowDataDTO MapToResultRowDataDTO(ResultRowEntity source, ResultRowDataDTO target = null)
        {
            if (source == null)
            {
                return(null);
            }
            if (target == null)
            {
                target = new ResultRowDataDTO();
            }

            target.AvgLapTime     = TimeSpanConverter.Convert(source.AvgLapTime);
            target.Car            = source.Car;
            target.CarClass       = source.CarClass;
            target.CarNumber      = source.CarNumber;
            target.ClassId        = source.ClassId;
            target.CompletedLaps  = source.CompletedLaps;
            target.FastestLapTime = TimeSpanConverter.Convert(source.FastestLapTime);
            target.FastLapNr      = source.FastLapNr;
            target.FinishPosition = source.FinishPosition;
            target.Incidents      = source.Incidents;
            target.Interval       = TimeSpanConverter.Convert(source.Interval);
            target.LeadLaps       = source.LeadLaps;
            target.Member         = MapToMemberInfoDTO(source.Member);
            target.PositionChange = source.PositionChange;
            target.QualifyingTime = TimeSpanConverter.Convert(source.QualifyingTime);
            target.ResultRowId    = source.ResultRowId;
            target.ResultId       = source.ResultId;
            target.StartPosition  = source.StartPosition;
            target.Status         = source.Status;

            return(target);
        }
        public ResultRowEntity MapToResultRowEntity(ResultRowDataDTO source, ResultRowEntity target = null)
        {
            if (source == null)
            {
                return(null);
            }
            if (target == null)
            {
                target = GetResultRowEntity(source);
            }

            target.AvgLapTime     = TimeSpanConverter.Convert(source.AvgLapTime);
            target.Car            = source.Car;
            target.CarClass       = source.CarClass;
            target.CarNumber      = source.CarNumber;
            target.ClassId        = source.ClassId;
            target.CompletedLaps  = source.CompletedLaps;
            target.FastestLapTime = TimeSpanConverter.Convert(source.FastestLapTime);
            target.FastLapNr      = source.FastLapNr;
            target.FinishPosition = source.FinishPosition;
            target.Incidents      = source.Incidents;
            target.Interval       = TimeSpanConverter.Convert(source.Interval);
            target.LeadLaps       = source.LeadLaps;
            target.Member         = GetMemberEntity(new LeagueMemberInfoDTO()
            {
                MemberId = source.MemberId
            });
            target.Team           = DefaultGet <TeamEntity>(source.TeamId);
            target.PositionChange = source.PositionChange;
            target.QualifyingTime = TimeSpanConverter.Convert(source.QualifyingTime);
            target.StartPosition  = source.StartPosition;
            target.Status         = source.Status;
            target.Result         = GetResultEntity(new ResultInfoDTO()
            {
                ResultId = source.ResultId
            });
            target.OldIRating      = source.OldIRating;
            target.NewIRating      = source.NewIRating;
            target.CompletedPct    = source.CompletedPct;
            target.OldSafetyRating = source.OldSafetyRating;
            target.NewSafetyRating = source.NewSafetyRating;
            target.OldLicenseLevel = source.OldLicenseLevel;
            target.NewLicenseLevel = source.NewLicenseLevel;
            target.OldCpi          = source.OldCpi;
            target.NewCpi          = source.NewCpi;

            return(target);
        }
        public ResultRowEntity GetResultRowEntity(ResultRowDataDTO source)
        {
            //if (source == null)
            //    return null;
            //ResultRowEntity target;

            //if (source.ResultRowId == null)
            //    target = new ResultRowEntity();
            //else
            //    target = DbContext.Set<ResultRowEntity>().Find(source.ResultRowId, source.ResultId);

            //if (target == null)
            //    throw new EntityNotFoundException(nameof(ResultRowEntity), "Could not find Entity in Database.", source.ResultRowId, source.ResultId);

            //return target;
            return(DefaultGet <ResultRowDataDTO, ResultRowEntity>(source));
        }