コード例 #1
0
        public void GetCoffeeMachines()
        {
            System.Console.Clear();
            var CoffeeMachines = coffeeMachineService.GetAll().ToList();

            CoffeeMachines.ForEach(x =>
                                   System.Console.WriteLine("{0} {1} {2}", x.Id, x.CoffeeMachineName, x.Producer)
                                   );
        }
コード例 #2
0
        public void MakeOrder()
        {
            var CoffeeMachines = coffeeMachineService.GetAll().ToList();

            CoffeeMachines.ForEach(x =>
            {
                System.Console.WriteLine("---- {0} ----", x.CoffeeMachineName);
                //coffeeMachineConsoleWriter.GetCoffeeMachineDrinks(x.Id);
                System.Console.WriteLine("\n\n");
            });
            System.Console.WriteLine();
            System.Console.WriteLine("Input drink number(№)");
            string str = System.Console.ReadLine();

            string[] strNums         = str.Split('a');
            int      coffeeMachineId = Int32.Parse(strNums[0]);
            int      drinkId         = Int32.Parse(strNums[1]);
            var      order           = new OrderView()
            {
                DrinkId = drinkId, CoffeeMachineId = coffeeMachineId
            };

            if (orderService.IsCorrectOrder(order))
            {
                orderService.AddOrder(order);
                System.Console.WriteLine("Thank you for your ordering");
            }
            else
            {
                System.Console.WriteLine("Please choose other drink!");
            }
        }