コード例 #1
0
ファイル: Order.cs プロジェクト: markashleybell/StoreSpike
        public void SetShippingContact(Contact contact)
        {
            ShippingContact = contact;

            if(ShippingContact == null)
            {
                ShippingMethod = null;
            }
            else
            { 
                // If the new shipping country is in the same zone , we can leave the current shipping
                // method for this order in place. If not, we need to change it to a shipping method which is
                // valid for the new shipping country
                if(ShippingMethod == null || ShippingMethod.ShippingZone.Code != ShippingContact.Country.ShippingZone.Code)
                {
                    var shippingMethod = GetValidShippingMethods().FirstOrDefault();

                    if(shippingMethod == null)
                        throw new Exception($"No valid shipping method found for shipping country {contact.Country}");

                    ShippingMethod = shippingMethod;
                }
            }
        }
コード例 #2
0
ファイル: Order.cs プロジェクト: markashleybell/StoreSpike
 public void SetBillingContact(Contact contact)
 {
     BillingContact = contact;
 }