Exemplo n.º 1
0
        public virtual Discount ToDiscount(orderDto.Discount discountDto, IEnumerable <Currency> availCurrencies, Language language)
        {
            var currency = availCurrencies.FirstOrDefault(x => x.Equals(discountDto.Currency)) ?? new Currency(language, discountDto.Currency);
            var result   = new Discount(currency);

            result.InjectFrom <NullableAndEnumValueInjecter>(discountDto);

            result.Amount = new Money(discountDto.DiscountAmount ?? 0, currency);

            return(result);
        }
Exemplo n.º 2
0
        public virtual Discount ToDiscount(orderDto.Discount discountDto, IEnumerable <Currency> availCurrencies, Language language)
        {
            var currency = availCurrencies.FirstOrDefault(x => x.Equals(discountDto.Currency)) ?? new Currency(language, discountDto.Currency);
            var result   = ServiceLocator.Current.GetInstance <MarketingFactory>().CreateDiscount(currency);

            result.InjectFrom <NullableAndEnumValueInjecter>(discountDto);

            result.Amount = new Money(discountDto.DiscountAmount ?? 0, currency);

            return(result);
        }
Exemplo n.º 3
0
        public virtual Discount ToDiscount(orderDto.Discount discountDto, IEnumerable <Currency> availCurrencies, Language language)
        {
            var currency = availCurrencies.FirstOrDefault(x => x.Equals(discountDto.Currency)) ?? new Currency(language, discountDto.Currency);
            var result   = new Discount(currency);

            result.Coupon      = discountDto.Coupon;
            result.Description = discountDto.Description;
            result.PromotionId = discountDto.PromotionId;

            result.Amount = new Money(discountDto.DiscountAmount ?? 0, currency);

            return(result);
        }
Exemplo n.º 4
0
 public static Discount ToDiscount(this orderDto.Discount discountDto, IEnumerable <Currency> availCurrencies, Language language)
 {
     return(OrderConverterInstance.ToDiscount(discountDto, availCurrencies, language));
 }