コード例 #1
0
        public CharacterClass CreateCharacterView()
        {
            List <MenuAction> selectClassMenu = _actionService.GetMenuActionsByMenuName("Select Class");
            int selectedClass;

            Console.WriteLine("Select class for your hero:");
            Console.WriteLine();

            for (int i = 0; i < selectClassMenu.Count; i++)
            {
                Console.WriteLine($"{selectClassMenu[i].Id}. {selectClassMenu[i].Name}");
            }

            var readedKey = Console.ReadKey();

            Int32.TryParse(readedKey.KeyChar.ToString(), out selectedClass);

            return((CharacterClass)selectedClass);
        }
コード例 #2
0
        public int ShowExpenseMenu()
        {
            var expenseMenu = _actionService.GetMenuActionsByMenuName("ExpenseMenu");

            Console.WriteLine("Wydatki.");

            for (int i = 0; i < expenseMenu.Count; i++)
            {
                Console.WriteLine($"{expenseMenu[i].Id}. {expenseMenu[i].Name}");
            }
            System.Console.WriteLine();

            string readedOperation = Console.ReadLine();
            int    operation;

            Int32.TryParse(readedOperation, out operation);
            System.Console.WriteLine();

            return(operation);
        }