Ejemplo n.º 1
0
        protected Team63LMSContext AddExistingCourse()
        {
            Team63LMSContext db = mockDB();

            Courses c = new Courses();

            c.Listing = "CS";
            c.Number  = 4150;
            c.Name    = "Algorithms";

            db.Courses.Add(c);

            db.SaveChanges();

            Courses c2 = new Courses();

            c2.Listing = "CS";
            c2.Number  = 4150;
            c2.Name    = "Algorithms";

            db.Courses.Add(c2);
            db.SaveChanges();

            return(db);
        }
Ejemplo n.º 2
0
        protected Team63LMSContext AddCourses()
        {
            Team63LMSContext db = mockDB();

            Courses c = new Courses();

            c.Listing = "CS";
            c.Number  = 4150;
            c.Name    = "Algorithms";

            db.Courses.Add(c);

            db.SaveChanges();

            Courses c2 = new Courses();

            c2.Listing = "CS";
            c2.Number  = 4600;
            c2.Name    = "Computer Graphics";

            db.Courses.Add(c2);
            db.SaveChanges();

            Courses c3 = new Courses();

            c3.Listing = "CS";
            c3.Number  = 4540;
            c3.Name    = "Web Software Architecture";

            db.Courses.Add(c3);
            db.SaveChanges();

            return(db);
        }
Ejemplo n.º 3
0
        protected Team63LMSContext AddProfessor2()
        {
            Team63LMSContext db = mockDB();

            Professors p = new Professors();

            p.FName   = "Ron";
            p.LName   = "Weasley";
            p.UId     = uIDGen(db);
            p.WorksIn = "EE";
            p.Dob     = new DateTime(1994, 09, 22);

            db.Professors.Add(p);
            db.SaveChanges();

            Professors p2 = new Professors();

            p2.FName   = "Kanny";
            p2.LName   = "Dopta";
            p2.UId     = uIDGen(db);
            p2.WorksIn = "EE";
            p2.Dob     = new DateTime(1992, 10, 23);

            db.Professors.Add(p2);
            db.SaveChanges();

            return(db);
        }
Ejemplo n.º 4
0
        protected Team63LMSContext AddProfessorCourseClass()
        {
            Team63LMSContext db = mockDB();

            AdministratorController controller = new AdministratorController();

            controller.UseLMSContext(db);

            // Create Professor to teach class
            Professors p = new Professors();

            p.FName   = "Danny";
            p.LName   = "Kopta";
            p.UId     = uIDGen(db);
            p.WorksIn = "CS";

            db.Professors.Add(p);
            db.SaveChanges();

            controller.CreateCourse("CS", 5530, "Database Systems");

            controller.CreateClass("CS", 1, "Spring", 2019, new DateTime(2009, 05, 30, 7, 9, 16),
                                   new DateTime(2009, 05, 30, 9, 16, 25), "WEB 1250", "u0000000");

            return(db);
        }
Ejemplo n.º 5
0
        protected Team63LMSContext AddClasses()
        {
            Team63LMSContext db = mockDB();

            AdministratorController controller = new AdministratorController();

            controller.UseLMSContext(db);

            // Create Professor to teach class
            Professors p = new Professors();

            p.FName   = "Danny";
            p.LName   = "Kopta";
            p.UId     = uIDGen(db);
            p.WorksIn = "CS";
            p.Dob     = new DateTime(1992, 10, 23);


            db.Professors.Add(p);
            db.SaveChanges();

            controller.CreateCourse("CS", 5530, "Database Systems");

            var query = from pr in db.Professors
                        select pr.UId;

            var query2 = from cr in db.Courses
                         select cr.CatalogId;

            // Create class associated with a CS course
            Classes c = new Classes();

            c.Loc        = "WEB 1250";
            c.Start      = new TimeSpan(7, 9, 16);
            c.End        = new TimeSpan(9, 16, 25);
            c.Semester   = "Spring 2019";
            c.TaughtBy   = query.SingleOrDefault();
            c.CategoryId = query2.SingleOrDefault();

            db.Classes.Add(c);

            db.SaveChanges();

            return(db);
        }
Ejemplo n.º 6
0
        protected Team63LMSContext AddAdministrator()
        {
            Team63LMSContext db = mockDB();

            Administrators a = new Administrators();

            a.FName = "Magnus";
            a.LName = "Carlsen";
            a.UId   = uIDGen(db);
            a.Dob   = new DateTime(1997, 10, 23);

            db.Administrators.Add(a);
            db.SaveChanges();

            return(db);
        }
Ejemplo n.º 7
0
        protected Team63LMSContext AddProfessor()
        {
            Team63LMSContext db = mockDB();

            Professors p = new Professors();

            p.FName   = "John";
            p.LName   = "Doe";
            p.UId     = uIDGen(db);
            p.WorksIn = "CS";
            p.Dob     = new DateTime(1997, 10, 23);

            db.Professors.Add(p);
            db.SaveChanges();

            return(db);
        }
Ejemplo n.º 8
0
        protected Team63LMSContext AddClasses2()
        {
            Team63LMSContext db = mockDB();

            AdministratorController controller = new AdministratorController();

            controller.UseLMSContext(db);

            // Create Professor to teach class
            Professors p = new Professors();

            p.FName   = "Danny";
            p.LName   = "Kopta";
            p.UId     = uIDGen(db);
            p.WorksIn = "CS";

            db.Professors.Add(p);
            db.SaveChanges();

            controller.CreateCourse("CS", 5530, "Database Systems");

            return(db);
        }
Ejemplo n.º 9
0
        protected Team63LMSContext AddStudentstoMultipleClasses()
        {
            Team63LMSContext        db         = mockDB();
            AdministratorController controller = new AdministratorController();

            controller.UseLMSContext(db);

            StudentController sController = new StudentController();

            sController.UseLMSContext(db);

            // Create Professor to teach class
            Professors p = new Professors();

            p.FName   = "Danny";
            p.LName   = "Kopta";
            p.UId     = uIDGen(db);
            p.WorksIn = "CS";

            db.Professors.Add(p);
            db.SaveChanges();

            controller.CreateCourse("CS", 5530, "Database Systems");
            controller.CreateCourse("CS", 4400, "Computer Systems");
            controller.CreateCourse("CS", 3500, "Software Practice I");

            controller.CreateClass("CS", 1, "Spring", 2019, new DateTime(2009, 05, 30, 7, 9, 16),
                                   new DateTime(2009, 05, 30, 9, 16, 25), "WEB 1250", "u0000000");

            controller.CreateClass("CS", 4400, "Spring", 2019, new DateTime(2009, 05, 30, 7, 9, 16),
                                   new DateTime(2009, 05, 30, 9, 16, 25), "WEB 2000", "u0000000");

            controller.CreateClass("CS", 3500, "Spring", 2019, new DateTime(2009, 05, 30, 7, 9, 16),
                                   new DateTime(2009, 05, 30, 9, 16, 25), "WEB 1999", "u0000000");

            //Add student to class
            Students s = new Students();

            s.UId   = "u0000001";
            s.FName = "Steen";
            s.LName = "Sia";
            s.Dob   = new DateTime(2000, 07, 01);
            s.Major = "Electrical Engineering";

            Students s2 = new Students();

            s.UId   = "u0000002";
            s.FName = "Benjamin";
            s.LName = "Button";
            s.Dob   = new DateTime(2000, 07, 01);
            s.Major = "Electrical Engineering";

            Students s3 = new Students();

            s.UId   = "u0000003";
            s.FName = "J";
            s.LName = "Fish";
            s.Dob   = new DateTime(2000, 07, 01);
            s.Major = "Computer Science";

            db.Students.Add(s);
            db.Students.Add(s2);
            db.Students.Add(s3);
            db.SaveChanges();

            sController.Enroll("CS", 5530, "Spring", 2019, "u0000001");
            sController.Enroll("CS", 5530, "Spring", 2019, "u0000002");
            sController.Enroll("CS", 4400, "Spring", 2019, "u0000001");
            sController.Enroll("CS", 4400, "Spring", 2019, "u0000002");
            sController.Enroll("CS", 3500, "Spring", 2019, "u0000003");
            sController.Enroll("CS", 3500, "Spring", 2019, "u0000001");

            return(db);
        }