protected void SaveBasket(Basket basket)
 {
     using (var sw = new StreamWriter(file, false))
     {
         sw.Write(SerializationHelper.DataContractSerialize(basket));
     }
 }
        public void CreateSampleShippingOptions()
        {
            var shippings = new Dictionary <string, ShippingBase>
            {
                {
                    "FlatRate", new FlatRateShipping
                    {
                        FlatRate = 1.5m
                    }
                },
                {
                    "PerRegion", new PerRegionShipping
                    {
                        PerRegionCosts = new List <RegionShippingCost>
                        {
                            new RegionShippingCost {
                                DestinationRegion = RegionShippingCost.Regions.UK, Amount = .5m
                            },
                            new RegionShippingCost {
                                DestinationRegion = RegionShippingCost.Regions.Europe, Amount = 1m
                            },
                            new RegionShippingCost {
                                DestinationRegion = RegionShippingCost.Regions.RestOfTheWorld, Amount = 2m
                            },
                        }
                    }
                },
                //Added by Kenny Loo
                {
                    "ByShip", new  ShippingByShip
                    {
                        ShippingByShipCost = new List <RegionShippingCost>
                        {
                            new RegionShippingCost {
                                DestinationRegion = RegionShippingCost.Regions.UK, Amount = .1m
                            },
                            new RegionShippingCost {
                                DestinationRegion = RegionShippingCost.Regions.Europe, Amount = .2m
                            },
                            new RegionShippingCost {
                                DestinationRegion = RegionShippingCost.Regions.RestOfTheWorld, Amount = .3m
                            },
                        }
                    }
                }
                //End
            };

            var ser = SerializationHelper.DataContractSerialize(shippings);

            using (var fileWriter = new StreamWriter(@"..\..\..\Marketplace.Interview.Web\App_Data\Shipping.xml", false))
            {
                fileWriter.Write(ser);
            }
        }