Example #1
0
        private static void SecondTierAction_Add(int secondTierChoice, out int back)
        {
            Manager manager = new Manager(); // to initialize manager class which includes database inserts

            back = 1;                        // default value to make the loop of the tier again, true for all the choises except the last one
            if (secondTierChoice == 1)       // Add Course
            {
                Courses cr = new Courses();  // to initialize and create an entity, then pass it to manager to insert it to db
                cr.CreateCourse();
                manager.AddCourse(cr);
            }
            else if (secondTierChoice == 2) // Add Student
            {
                Students st = new Students();
                st.CreateStudent();
                manager.AddStudent(st);
            }
            else if (secondTierChoice == 3) // Add Trainer
            {
                Trainers tr = new Trainers();
                tr.CreateTrainer();
                manager.AddTrainer(tr);
            }
            else if (secondTierChoice == 4) // Add Assignment
            {
                Assignments ag = new Assignments();
                ag.CreateAssignment();
                manager.AddAssignment(ag);
            }
            else
            {
                back = 0;
            }
        }