Пример #1
0
        public DriverStatisticDTO MapToDriverStatisticDTO(StatisticSetEntity source, DriverStatisticDTO target = null)
        {
            if (source == null)
            {
                return(null);
            }
            if (target == null)
            {
                target = new DriverStatisticDTO();
            }

            target.StatisticSetId      = source.Id;
            target.DriverStatisticRows = source.DriverStatistic.Select(x => MapToDriverStatisticRowDTO(x)).ToArray();

            return(target);
        }
Пример #2
0
        public StatisticSetDTO MapToStatisticSetDTO(StatisticSetEntity source, StatisticSetDTO target = null)
        {
            if (source == null)
            {
                return(null);
            }
            if (target == null)
            {
                target = new StatisticSetDTO();
            }

            MapToVersionDTO(source, target);
            target.Id             = source.Id;
            target.Name           = source.Name;
            target.UpdateInterval = TimeSpanConverter.Convert(source.UpdateInterval);
            target.UpdateTime     = source.UpdateTime.GetValueOrDefault();

            return(target);
        }
Пример #3
0
        public StatisticSetEntity MapToStatisticSetEntity(StatisticSetDTO source, StatisticSetEntity target = null, bool force = false)
        {
            if (source == null)
            {
                return(null);
            }
            if (target == null)
            {
                throw new ArgumentNullException(nameof(target));
            }

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

            target.Name                  = source.Name;
            target.UpdateInterval        = TimeSpanConverter.Convert(source.UpdateInterval);
            target.UpdateTime            = source.UpdateTime;
            target.RequiresRecalculation = true;

            return(target);
        }