protected override void ProcessDemo()
        {
            var productMemory = new ProductMemory();

            productMemory.Attach(new Product("PC", 2999));
            productMemory.Attach(new Product("Car", 29999));
            productMemory.Attach(new Product("Headphone", 99));

            productMemory.Accept(new DiscountPriceVisitor());
            productMemory.Accept(new RegularPriceVisitor());
            productMemory.Accept(new DiscountPriceVisitor());
            productMemory.Accept(new BasePriceVisitor());
            productMemory.Accept(new RegularPriceVisitor());
        }
Esempio n. 2
0
 public ActionResult Index(Product product)
 {
     ProductMemory.AddProduct(product.Name, product.Category);
     return(View(ProductMemory.products));
 }