Example #1
0
        public void StockUp(string nameString, string priceString, string amountString)
        {
            string name       = nameString.Trim().ToLower();
            int    price      = _inputValidation.ConvertPrice(priceString);
            int    amount     = _inputValidation.ConvertAmount(amountString);
            string stockUpMsg = "";

            for (int i = 0; i < amount; i++)
            {
                ProductsList.Add(new Products()
                {
                    ProductName = name,
                    Price       = price
                });
            }
            if (amount == 1)
            {
                stockUpMsg += $"{amount} {name} was added to the shop with the price of {price} $";
            }
            else
            {
                stockUpMsg += $"{amount} {name} products ware added to the shop with the price of {price} $";
            }
            _service.WriteResult(stockUpMsg);
        }
Example #2
0
        public void PutToBudget(string amountString)
        {
            int    amount    = _inputValidation.ConvertAmount(amountString);
            string budjetMsg = "";

            if (amount > 100 || amount <= 0)
            {
                budjetMsg += "Sorry, but we cannot increase your budget for this amount";
            }
            else
            {
                this.MoneyOnAccoutn += amount;
                budjetMsg           += $"{amount} $ was added on your account. \n Currently on your acoount: {this.MoneyOnAccoutn}";
            }
            _service.WriteResult(budjetMsg);
        }