public void PayTShirt(TShirt shirt) { Console.OutputEncoding = System.Text.Encoding.UTF8; Console.WriteLine(); foreach (var variation in this.variations) { variation.Cost(shirt); Console.ForegroundColor = ConsoleColor.Magenta; System.Globalization.CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture("it-IT"); Console.WriteLine($"TShirt cost after applying {variation.GetType().Name} is: {shirt.Price :C2}"); } Console.OutputEncoding = System.Text.Encoding.UTF8; Console.WriteLine(); Console.ForegroundColor = ConsoleColor.Cyan; System.Globalization.CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture("it-IT"); Console.WriteLine($"Total Price: {shirt.Price :C2}"); paymentMethod.Pay(shirt.Price); Console.WriteLine(); Console.ForegroundColor = ConsoleColor.White; }
public static void BuyTShirt() { List <IVariationStrategy> variations = new List <IVariationStrategy>() { new SizeVariation(), new ColorVariation(), new FabricVariation() }; Size size = ChooseSize(); Color color = ChooseColor(); Fabric fabric = ChooseFabric(); TShirt shirt = new TShirt(size, color, fabric); EShop eshop = new EShop(variations); PaymentMethods paymentMethod = ChoosePaymentMethod(); eshop.SetPaymentMethod(paymentMethod); eshop.PayTShirt(shirt); }