Beispiel #1
0
        public static DTO.PricingEverydayKeyValueDriverGroup ToDto(this Display.PricingEverydayKeyValueDriverGroup displayEntity)
        {
            var markupRules = new List <DTO.PriceMarkupRule>();

            foreach (Display.PriceMarkupRule rule in displayEntity.MarkupRules)
            {
                markupRules.Add(rule.ToDto());
            }

            var optimizationRules = new List <DTO.PriceOptimizationRule>();

            foreach (Display.PriceOptimizationRule rule in displayEntity.OptimizationRules)
            {
                optimizationRules.Add(rule.ToDto());
            }

            var dto = new DTO.PricingEverydayKeyValueDriverGroup(
                displayEntity.ValueDriverGroupId,
                markupRules,
                optimizationRules);

            return(dto);
        }
Beispiel #2
0
        public static Display.PricingEverydayKeyValueDriverGroup ToDisplayEntity(this DTO.PricingEverydayKeyValueDriverGroup dto)
        {
            var displayEntity = new Display.PricingEverydayKeyValueDriverGroup();

            displayEntity.ValueDriverGroupId = dto.ValueDriverGroupId;

            if (dto.MarkupRules != null)
            {
                foreach (var rule in dto.MarkupRules)
                {
                    displayEntity.MarkupRules.Add(rule.ToDisplayEntity());
                }
            }
            if (dto.OptimizationRules != null)
            {
                foreach (var rule in dto.OptimizationRules)
                {
                    displayEntity.OptimizationRules.Add(rule.ToDisplayEntity());
                }
            }

            return(displayEntity);
        }