Example #1
0
    private void addQuestion()
    {
        while (true)
        {
            Console.Write("Enter statement : ");
            string s = Console.ReadLine();

            Console.Write("Enter option 1 : ");
            string op1 = Console.ReadLine();

            Console.Write("Enter option 2 : ");
            string op2 = Console.ReadLine();

            Console.Write("Enter option 3 : ");
            string op3 = Console.ReadLine();

            Console.Write("Enter option 4 : ");
            string op4 = Console.ReadLine();

            Console.Write("Enter correct answer : ");
            int ca = Convert.ToInt32(Console.ReadLine());

            questionLogic.AddQuestionToSQL(s, op1, op2, op3, op4, ca);

            Console.Write("1. Add new question");
            Console.Write("2. Quit Command");
            int choice;
            if (int.TryParse(Console.ReadLine(), out choice))
            {
                if (choice == 1)
                {
                    continue;
                }

                if (choice == 2)
                {
                    break;
                }
            }
            else
            {
                Console.WriteLine("Choose either 1 or 2");
            }
        }
    }