Beispiel #1
0
        private decimal AddItem(Order order)
        {
            string productCode = _validate.ValidateEmptyInput("Select a Bubble Tea from above table by Product Id");

            int id = Int32.Parse(productCode);

            int     quantity = _validate.ValidateQuantity("Enter quantity for this item");
            Product product  = _productBL.GetProductById(id);

            //To-Do check enough inventory
            Item inventory = _inventoryBL.GetInventory(product);

            _orderBL.AddOrderItem(order, product, new Item(quantity));

            //To-Do update inventory
            int newQuantity = inventory.Quantity - quantity;

            _inventoryBL.UpdateInventory(inventory, newQuantity);

            Console.WriteLine($"{quantity} {product.Name} is added");
            return //product.Price * quantity;

                   (_orderBL.GetTotal(product.Id, quantity));
        }