コード例 #1
0
        /// <summary>
        /// calls the ConsoleView.DisplayGetNumberOfUnitsToSell method and the SubtractProduct method if a valid integer is returned
        /// </summary>
        private void Sell()
        {
            if (_salesperson.CurrentStock != null)
            {
                int numberOfUnits = _consoleView.DisplayGetNumberOfUnitsToSell(_salesperson.CurrentStock);
                _salesperson.CurrentStock.SubtractProducts(numberOfUnits);

                if (_salesperson.CurrentStock.OnBackorder)
                {
                    _consoleView.DisplayBackOrderNotification(_salesperson.CurrentStock, numberOfUnits);
                }
            }
            else
            {
                _consoleView.DisplayObjectError("product");
            }
        }