コード例 #1
0
        private bool IsPurchase(Items item, bool isCanPurchase)
        {
            if (_snackRepository.GetMonyinMachine() >= item.Price)
            {
                _snackRepository.RetreiveItem(item.ItemNo);
                Console.WriteLine(
                    $"Thank you for your purchase of {item.ProductName} and the remaining amount is {_snackRepository.GetMonyinMachine()}$");
                isCanPurchase = true;
            }
            else
            {
                Console.WriteLine($"the total amout is: {_snackRepository.GetMonyinMachine()}");
            }

            return(isCanPurchase);
        }