public static coreModel.ShoppingCart ToCoreModel(this webModel.ShoppingCart cart) { var retVal = new coreModel.ShoppingCart(); retVal.InjectFrom(cart); retVal.Currency = cart.Currency; if(cart.Addresses != null) retVal.Addresses = cart.Addresses.Select(x => x.ToCoreModel()).ToList(); if(cart.Items != null) retVal.Items = cart.Items.Select(x => x.ToCoreModel()).ToList(); if(cart.Payments != null) retVal.Payments = cart.Payments.Select(x => x.ToCoreModel()).ToList(); if(cart.Shipments != null) retVal.Shipments = cart.Shipments.Select(x => x.ToCoreModel()).ToList(); if(cart.Discounts != null) retVal.Discounts = cart.Discounts.Select(x => x.ToCoreModel()).ToList(); if(cart.Coupon != null) { retVal.Coupon = new coreModel.Coupon() { CouponCode = cart.Coupon.CouponCode, InvalidDescription = cart.Coupon.InvalidDescription }; } retVal.TaxDetails = cart.TaxDetails; return retVal; }
public static ShoppingCart ToCoreModel(this ShoppingCartEntity entity) { if (entity == null) throw new ArgumentNullException("entity"); var retVal = new ShoppingCart(); retVal.InjectFrom(entity); retVal.Currency = (CurrencyCodes)Enum.Parse(typeof(CurrencyCodes), entity.Currency); if (entity.Items != null) { retVal.Items = entity.Items.Select(x => x.ToCoreModel()).ToList(); } if (entity.Addresses != null) { retVal.Addresses = entity.Addresses.Select(x => x.ToCoreModel()).ToList(); } if (entity.Shipments != null) { retVal.Shipments = entity.Shipments.Select(x => x.ToCoreModel()).ToList(); } if (entity.Payments != null) { retVal.Payments = entity.Payments.Select(x => x.ToCoreModel()).ToList(); } retVal.TaxDetails = entity.TaxDetails.Select(x => x.ToCoreModel()).ToList(); return retVal; }
public static ShoppingCart ToCoreModel(this ShoppingCartEntity entity) { if (entity == null) throw new ArgumentNullException("entity"); var retVal = new ShoppingCart(); retVal.InjectFrom(entity); retVal.Currency = entity.Currency; retVal.Items = entity.Items.Select(x => x.ToCoreModel()).ToList(); retVal.Addresses = entity.Addresses.Select(x => x.ToCoreModel()).ToList(); retVal.Shipments = entity.Shipments.Select(x => x.ToCoreModel()).ToList(); retVal.Payments = entity.Payments.Select(x => x.ToCoreModel()).ToList(); retVal.TaxDetails = entity.TaxDetails.Select(x => x.ToCoreModel()).ToList(); retVal.Discounts = entity.Discounts.Select(x => x.ToCoreModel()).ToList(); return retVal; }
public static coreModel.ShoppingCart ToCoreModel(this webModel.ShoppingCart cart) { var retVal = new coreModel.ShoppingCart(); retVal.InjectFrom(cart); retVal.Currency = cart.Currency; if (cart.Addresses != null) { retVal.Addresses = cart.Addresses.Select(x => x.ToCoreModel()).ToList(); } if (cart.Items != null) { retVal.Items = cart.Items.Select(x => x.ToCoreModel()).ToList(); } if (cart.Payments != null) { retVal.Payments = cart.Payments.Select(x => x.ToCoreModel()).ToList(); } if (cart.Shipments != null) { retVal.Shipments = cart.Shipments.Select(x => x.ToCoreModel()).ToList(); } if (cart.Discounts != null) { retVal.Discounts = cart.Discounts.Select(x => x.ToCoreModel()).ToList(); } if (cart.Coupon != null) { retVal.Coupon = new coreModel.Coupon() { CouponCode = cart.Coupon.CouponCode, InvalidDescription = cart.Coupon.InvalidDescription }; } retVal.TaxDetails = cart.TaxDetails; return(retVal); }
public static cartCoreModel.ShoppingCart ToCartModel(this coreModel.QuoteRequest quoteRequest) { var retVal = new cartCoreModel.ShoppingCart(); retVal.InjectFrom(quoteRequest); retVal.Currency = quoteRequest.Currency; if (quoteRequest.Items != null) { retVal.Items = quoteRequest.Items.Select(x => x.ToCartModel()).ToList(); } if(quoteRequest.ShipmentMethod != null) { var shipment = new cartCoreModel.Shipment { Currency = quoteRequest.Currency, ShipmentMethodCode = quoteRequest.ShipmentMethod.ShipmentMethodCode, ShipmentMethodOption = quoteRequest.ShipmentMethod.OptionName }; retVal.Shipments = new List<cartCoreModel.Shipment>(new[] { shipment }); } return retVal; }
public static coreModel.ShoppingCart ToCoreModel(this webModel.ShoppingCart cart) { var retVal = new coreModel.ShoppingCart(); retVal.InjectFrom(cart); retVal.Currency = cart.Currency; if (cart.Addresses != null) { retVal.Addresses = cart.Addresses.Select(x => x.ToCoreModel()).ToList(); } if (cart.Items != null) { retVal.Items = cart.Items.Select(x => x.ToCoreModel()).ToList(); } if (cart.Payments != null) { retVal.Payments = cart.Payments.Select(x => x.ToCoreModel()).ToList(); } if (cart.Shipments != null) { retVal.Shipments = cart.Shipments.Select(x => x.ToCoreModel()).ToList(); } if (cart.Discounts != null) { retVal.Discounts = cart.Discounts.Select(x => x.ToCoreModel()).ToList(); } if (cart.DynamicProperties != null) { retVal.DynamicProperties = cart.DynamicProperties; } retVal.TaxDetails = cart.TaxDetails; return(retVal); }
public static cartCoreModel.ShoppingCart ToCartModel(this coreModel.QuoteRequest quoteRequest) { var retVal = new cartCoreModel.ShoppingCart(); retVal.InjectFrom(quoteRequest); retVal.Currency = quoteRequest.Currency; if (quoteRequest.Items != null) { retVal.Items = quoteRequest.Items.Select(x => x.ToCartModel()).ToList(); } if (quoteRequest.ShipmentMethod != null) { var shipment = new cartCoreModel.Shipment { Currency = quoteRequest.Currency, ShipmentMethodCode = quoteRequest.ShipmentMethod.ShipmentMethodCode, ShipmentMethodOption = quoteRequest.ShipmentMethod.OptionName }; retVal.Shipments = new List <cartCoreModel.Shipment>(new[] { shipment }); } return(retVal); }
public static coreModel.ShoppingCart ToCoreModel(this webModel.ShoppingCart cart) { var retVal = new coreModel.ShoppingCart(); retVal.InjectFrom(cart); retVal.Currency = cart.Currency; if(cart.Addresses != null) retVal.Addresses = cart.Addresses.Select(x => x.ToCoreModel()).ToList(); if(cart.Items != null) retVal.Items = cart.Items.Select(x => x.ToCoreModel()).ToList(); if(cart.Payments != null) retVal.Payments = cart.Payments.Select(x => x.ToCoreModel()).ToList(); if(cart.Shipments != null) retVal.Shipments = cart.Shipments.Select(x => x.ToCoreModel()).ToList(); if(cart.Discounts != null) retVal.Discounts = cart.Discounts.Select(x => x.ToCoreModel()).ToList(); if (cart.DynamicProperties != null) retVal.DynamicProperties = cart.DynamicProperties; retVal.TaxDetails = cart.TaxDetails; return retVal; }