Example #1
0
        public ImportedStatisticSetDTO MapToImportedStatisticSetDTO(ImportedStatisticSetEntity source, ImportedStatisticSetDTO target = null)
        {
            if (source == null)
            {
                return(null);
            }
            if (target == null)
            {
                target = new ImportedStatisticSetDTO();
            }

            MapToStatisticSetDTO(source, target);
            target.Description  = source.Description;
            target.ImportSource = source.ImportSource;
            target.FirstDate    = source.FirstDate.GetValueOrDefault();
            target.LastDate     = source.LastDate.GetValueOrDefault();

            return(target);
        }
Example #2
0
        public ImportedStatisticSetEntity MapToImportedStatisticSetEntity(DriverStatisticDTO source, ImportedStatisticSetEntity target = null)
        {
            if (source == null)
            {
                return(null);
            }
            if (target == null)
            {
                target = DefaultGet <ImportedStatisticSetEntity>(new object[] { source.StatisticSetId });
            }

            MapCollection(source.DriverStatisticRows, target.DriverStatistic, MapToDriverStatisticRowEntity, x => x.Keys,
                          removeFromCollection: true, removeFromDatabase: true, autoAddMissing: true);
            target.FirstDate = target.DriverStatistic.Min(x => x.FirstSessionDate);
            target.LastDate  = target.DriverStatistic.Max(x => x.LastSessionDate);

            return(target);
        }
Example #3
0
        public ImportedStatisticSetEntity MapToImportedStatisticSetEntity(ImportedStatisticSetDTO source, ImportedStatisticSetEntity target = null)
        {
            if (source == null)
            {
                return(null);
            }
            if (target == null)
            {
                target = DefaultGet <ImportedStatisticSetEntity>(source);
            }

            if (MapToRevision(source, target) == false)
            {
                return(target);
            }

            MapToStatisticSetEntity(source, target, force: true);
            target.Description  = source.Description;
            target.FirstDate    = source.FirstDate;
            target.LastDate     = source.LastDate;
            target.ImportSource = source.ImportSource;

            return(target);
        }