Esempio n. 1
0
 private void DisplayProducts(IVendingMachineService vendingMachineService)
 {
     foreach (var vendingMachineItem in vendingMachineService.GetProductMap())
     {
         Console.WriteLine(vendingMachineItem.Value.TotalItem > 0
             ? $"{vendingMachineItem.Key} {vendingMachineItem.Value.ProductName} ({vendingMachineItem.Value.TotalItem}): ${vendingMachineItem.Value.Price}"
             : $"{vendingMachineItem.Key} {vendingMachineItem.Value.ProductName} ({vendingMachineItem.Value.TotalItem}): ${vendingMachineItem.Value.Price}: is out of stock.");
     }
 }