コード例 #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
ファイル: Controller.cs プロジェクト: lewins1/SalesTracker
        private void Buy()
        {
            int numberOfUnits = _consoleView.DisplayGetNumberOfUnitsToBuy(_salesperson.CurrentStock);

            _salesperson.CurrentStock.AddProducts(numberOfUnits);
        }