예제 #1
0
        public SelectedProduct GetSelectedProductDetails(ProductType productType)
        {
            switch (productType)
            {
            case ProductType.Cola:
            {
                SelectedProduct.Price = cola.GetPrice();
                SelectedProduct.Stock = cola.GetStock();
                return(SelectedProduct);
            }

            case ProductType.Chips:
            {
                SelectedProduct.Price = chips.GetPrice();
                SelectedProduct.Stock = chips.GetStock();
                return(SelectedProduct);
            }

            case ProductType.Candy:
            {
                SelectedProduct.Price = candy.GetPrice();
                SelectedProduct.Stock = candy.GetStock();
                return(SelectedProduct);
            }

            default:
                return(null);
            }
        }