示例#1
0
        /// <summary>
        /// Gets the number of units to buy from the user, then applies it to the inventory
        /// </summary>
        private void Buy()
        {
            Product.ProductType productType;
            //
            // Get the number of units to buy from the view
            //
            int numToBuy = _consoleView.DisplayGetNumberOfUnitsToBuy(out productType);

            //
            // Add that number to the product stock
            //
            if (numToBuy > 0)
            {
                _salesPerson.CurrentStock[productType].AddProducts(numToBuy);
                if (_salesPerson.CitiesVisited.Count > 0)
                {
                    _salesPerson.CitiesVisited.Last().BuyProducts(numToBuy);
                }
            }
        }
示例#2
0
        private void Buy()
        {
            int numberOfUnits = _consoleView.DisplayGetNumberOfUnitsToBuy(_salesperson.CurrentStock);

            _salesperson.CurrentStock.AddProducts(numberOfUnits);
        }