Example #1
0
        private MenuOptionResult AddStudent()
        {
            string  studentFName  = hogwarts.GetString("Provide first name for the new student:");
            string  studentLName  = hogwarts.GetString("Provide last name for the new student:");
            string  gender        = hogwarts.GetString("Provide gender (M, F, O):");
            int     hogwartsHouse = GetInteger("Provide the Hogwarts' House ID for the new student ((1) Gryffindor, (2) Slytherin, (3) Ravenclaw, or (4) Hufflepuff):", null, new int[] { 1, 2, 3, 4 });
            int     teClass       = GetInteger("Provide the Tech Elevator Class for the new student ((1) .NET, (2) Java, or (3) Other):", null, new int[] { 1, 2, 3 });
            Student newStudent    = new Student
            {
                FirstName       = studentFName,
                LastName        = studentLName,
                Gender          = gender,
                HogwartsHouseID = hogwartsHouse,
                TEClassID       = teClass
            };

            int id = studentDAO.CreateStudent(newStudent);

            if (id > 0)
            {
                Console.WriteLine("*** SUCCESS ***");
            }
            else
            {
                Console.WriteLine("*** DID NOT CREATE ***");
            }
            return(MenuOptionResult.WaitAfterMenuSelection);
        }