Пример #1
0
        public static void GetList()
        {
            List <BakeryItem> bakeryResult     = BakeryItem.GetAll();
            double            bakeryTotalPrice = 0;

            foreach (BakeryItem item in bakeryResult)
            {
                bakeryTotalPrice += item.Price;
            }
            Console.WriteLine("Your total price is " + bakeryTotalPrice);
        }
Пример #2
0
        public void MakePurchase(string itemName, int quantity)
        {
            int price;

            if (pastryItems.TryGetValue(itemName, out price))
            {
                BakeryItem pastry = new BakeryItem(itemName, price, quantity);
            }
            else if (breadItems.TryGetValue(itemName, out price))
            {
                BakeryItem bread = new BakeryItem(itemName, price, quantity);
            }
            else
            {
                WriteLine($"Sorry, can't find {itemName} on the menu.");
                DrawLine();
                StartStore();
            }
        }