Exemple #1
0
 public StudentManager(UniversityContext context)
 {
     _context = context;
 }
 public AdminDepartmentsController(UniversityContext context)
 {
     db = context;
 }
Exemple #3
0
 public AppController(UniversityContext universityContext)
 {
     _universityContext = universityContext;
 }
Exemple #4
0
 public DepartmentController(UniversityContext context)
 {
     _context = context;
 }
 public StudentsController(UniversityContext context, IDistributedCache distributedCache)
 {
     _context = context;
     _cache   = distributedCache;
 }
Exemple #6
0
 public StudentGroupController(UniversityContext db)
 {
     this.db = db;
 }
Exemple #7
0
 public CourseController(UniversityContext context)
 {
     _context = context;
 }
Exemple #8
0
 protected AbstractFacade(UniversityContext context)
 {
     GetContext = context;
 }
Exemple #9
0
 public InstructorRepository(UniversityContext db)
 {
     this.db = db;
 }
 public CourseRepository(UniversityContext ctx)
 {
     _ctx = ctx;
 }
Exemple #11
0
 public CourseRepository(UniversityContext db) : base(db)
 {
 }
 public ReportsController(UniversityContext context)
 {
     db = context;
 }
Exemple #13
0
 public LessonsController(UniversityContext context)
 {
     _context = context;
 }
Exemple #14
0
 public StudentsController(UniversityContext db, IMapper mapper)
 {
     this.db     = db;
     this.mapper = mapper;
     faker       = new Faker("sv");
 }
 public StudentsController(UniversityContext context, IStudentManager studentManager)
 {
     _context = context;
     //LAB6 - как параметр контроллера
     _studentManager = studentManager;
 }
 public HomeController(UniversityContext context)
 {
     _context = context;
 }
Exemple #17
0
        protected override void Seed(UniversityContext context)
        {
            var students = new List <Student>
            {
                new Student {
                    FirstMidName   = "Carson", LastName = "Alexander",
                    EnrollmentDate = DateTime.Parse("2010-09-01")
                },
                new Student {
                    FirstMidName   = "Meredith", LastName = "Alonso",
                    EnrollmentDate = DateTime.Parse("2012-09-01")
                },
                new Student {
                    FirstMidName   = "Arturo", LastName = "Anand",
                    EnrollmentDate = DateTime.Parse("2013-09-01")
                },
                new Student {
                    FirstMidName   = "Gytis", LastName = "Barzdukas",
                    EnrollmentDate = DateTime.Parse("2012-09-01")
                },
                new Student {
                    FirstMidName   = "Yan", LastName = "Li",
                    EnrollmentDate = DateTime.Parse("2012-09-01")
                },
                new Student {
                    FirstMidName   = "Peggy", LastName = "Justice",
                    EnrollmentDate = DateTime.Parse("2011-09-01")
                },
                new Student {
                    FirstMidName   = "Laura", LastName = "Norman",
                    EnrollmentDate = DateTime.Parse("2013-09-01")
                },
                new Student {
                    FirstMidName   = "Nino", LastName = "Olivetto",
                    EnrollmentDate = DateTime.Parse("2005-09-01")
                }
            };


            students.ForEach(s => context.Students.AddOrUpdate(p => p.LastName, s));
            context.SaveChanges();

            var instructors = new List <Instructor>
            {
                new Instructor {
                    FirstMidName = "Kim", LastName = "Abercrombie",
                    HireDate     = DateTime.Parse("1995-03-11")
                },
                new Instructor {
                    FirstMidName = "Fadi", LastName = "Fakhouri",
                    HireDate     = DateTime.Parse("2002-07-06")
                },
                new Instructor {
                    FirstMidName = "Roger", LastName = "Harui",
                    HireDate     = DateTime.Parse("1998-07-01")
                },
                new Instructor {
                    FirstMidName = "Candace", LastName = "Kapoor",
                    HireDate     = DateTime.Parse("2001-01-15")
                },
                new Instructor {
                    FirstMidName = "Roger", LastName = "Zheng",
                    HireDate     = DateTime.Parse("2004-02-12")
                }
            };

            instructors.ForEach(s => context.Instructors.AddOrUpdate(p => p.LastName, s));
            context.SaveChanges();

            var departments = new List <Department>
            {
                new Department {
                    Name      = "English", Budget = 350000,
                    StartDate = DateTime.Parse("2007-09-01"),
                    PersonID  = instructors.Single(i => i.LastName == "Abercrombie").PersonID
                },
                new Department {
                    Name      = "Mathematics", Budget = 100000,
                    StartDate = DateTime.Parse("2007-09-01"),
                    PersonID  = instructors.Single(i => i.LastName == "Fakhouri").PersonID
                },
                new Department {
                    Name      = "Engineering", Budget = 350000,
                    StartDate = DateTime.Parse("2007-09-01"),
                    PersonID  = instructors.Single(i => i.LastName == "Harui").PersonID
                },
                new Department {
                    Name      = "Economics", Budget = 100000,
                    StartDate = DateTime.Parse("2007-09-01"),
                    PersonID  = instructors.Single(i => i.LastName == "Kapoor").PersonID
                }
            };

            departments.ForEach(s => context.Departments.AddOrUpdate(p => p.Name, s));
            context.SaveChanges();

            var courses = new List <Course>
            {
                new Course {
                    CourseID     = 1050, Title = "Chemistry", Credits = 3,
                    DepartmentID = departments.Single(s => s.Name == "Engineering").DepartmentID,
                    Instructors  = new List <Instructor>()
                },
                new Course {
                    CourseID     = 4022, Title = "Microeconomics", Credits = 3,
                    DepartmentID = departments.Single(s => s.Name == "Economics").DepartmentID,
                    Instructors  = new List <Instructor>()
                },
                new Course {
                    CourseID     = 4041, Title = "Macroeconomics", Credits = 3,
                    DepartmentID = departments.Single(s => s.Name == "Economics").DepartmentID,
                    Instructors  = new List <Instructor>()
                },
                new Course {
                    CourseID     = 1045, Title = "Calculus", Credits = 4,
                    DepartmentID = departments.Single(s => s.Name == "Mathematics").DepartmentID,
                    Instructors  = new List <Instructor>()
                },
                new Course {
                    CourseID     = 3141, Title = "Trigonometry", Credits = 4,
                    DepartmentID = departments.Single(s => s.Name == "Mathematics").DepartmentID,
                    Instructors  = new List <Instructor>()
                },
                new Course {
                    CourseID     = 2021, Title = "Composition", Credits = 3,
                    DepartmentID = departments.Single(s => s.Name == "English").DepartmentID,
                    Instructors  = new List <Instructor>()
                },
                new Course {
                    CourseID     = 2042, Title = "Literature", Credits = 4,
                    DepartmentID = departments.Single(s => s.Name == "English").DepartmentID,
                    Instructors  = new List <Instructor>()
                },
            };

            courses.ForEach(s => context.Courses.AddOrUpdate(p => p.CourseID, s));
            context.SaveChanges();

            var officeAssignments = new List <OfficeAssignment>
            {
                new OfficeAssignment {
                    PersonID = instructors.Single(i => i.LastName == "Fakhouri").PersonID,
                    Location = "Smith 17"
                },
                new OfficeAssignment {
                    PersonID = instructors.Single(i => i.LastName == "Harui").PersonID,
                    Location = "Gowan 27"
                },
                new OfficeAssignment {
                    PersonID = instructors.Single(i => i.LastName == "Kapoor").PersonID,
                    Location = "Thompson 304"
                },
            };

            officeAssignments.ForEach(s => context.OfficeAssignments.AddOrUpdate(p => p.Location, s));
            context.SaveChanges();

            AddOrUpdateInstructor(context, "Chemistry", "Kapoor");
            AddOrUpdateInstructor(context, "Chemistry", "Harui");
            AddOrUpdateInstructor(context, "Microeconomics", "Zheng");
            AddOrUpdateInstructor(context, "Macroeconomics", "Zheng");

            AddOrUpdateInstructor(context, "Calculus", "Fakhouri");
            AddOrUpdateInstructor(context, "Trigonometry", "Harui");
            AddOrUpdateInstructor(context, "Composition", "Abercrombie");
            AddOrUpdateInstructor(context, "Literature", "Abercrombie");

            context.SaveChanges();

            var enrollments = new List <Enrollment>
            {
                new Enrollment {
                    PersonID = students.Single(s => s.LastName == "Alexander").PersonID,
                    CourseID = courses.Single(c => c.Title == "Chemistry").CourseID,
                    Grade    = Grade.A
                },
                new Enrollment {
                    PersonID = students.Single(s => s.LastName == "Alexander").PersonID,
                    CourseID = courses.Single(c => c.Title == "Microeconomics").CourseID,
                    Grade    = Grade.C
                },
                new Enrollment {
                    PersonID = students.Single(s => s.LastName == "Alexander").PersonID,
                    CourseID = courses.Single(c => c.Title == "Macroeconomics").CourseID,
                    Grade    = Grade.B
                },
                new Enrollment {
                    PersonID = students.Single(s => s.LastName == "Alonso").PersonID,
                    CourseID = courses.Single(c => c.Title == "Calculus").CourseID,
                    Grade    = Grade.B
                },
                new Enrollment {
                    PersonID = students.Single(s => s.LastName == "Alonso").PersonID,
                    CourseID = courses.Single(c => c.Title == "Trigonometry").CourseID,
                    Grade    = Grade.B
                },
                new Enrollment {
                    PersonID = students.Single(s => s.LastName == "Alonso").PersonID,
                    CourseID = courses.Single(c => c.Title == "Composition").CourseID,
                    Grade    = Grade.B
                },
                new Enrollment {
                    PersonID = students.Single(s => s.LastName == "Anand").PersonID,
                    CourseID = courses.Single(c => c.Title == "Chemistry").CourseID
                },
                new Enrollment {
                    PersonID = students.Single(s => s.LastName == "Anand").PersonID,
                    CourseID = courses.Single(c => c.Title == "Microeconomics").CourseID,
                    Grade    = Grade.B
                },
                new Enrollment {
                    PersonID = students.Single(s => s.LastName == "Barzdukas").PersonID,
                    CourseID = courses.Single(c => c.Title == "Chemistry").CourseID,
                    Grade    = Grade.B
                },
                new Enrollment {
                    PersonID = students.Single(s => s.LastName == "Li").PersonID,
                    CourseID = courses.Single(c => c.Title == "Composition").CourseID,
                    Grade    = Grade.B
                },
                new Enrollment {
                    PersonID = students.Single(s => s.LastName == "Justice").PersonID,
                    CourseID = courses.Single(c => c.Title == "Literature").CourseID,
                    Grade    = Grade.B
                }
            };

            foreach (Enrollment e in enrollments)
            {
                var enrollmentInDataBase = context.Enrollments.Where(
                    s =>
                    s.Student.PersonID == e.PersonID &&
                    s.Course.CourseID == e.CourseID).SingleOrDefault();
                if (enrollmentInDataBase == null)
                {
                    context.Enrollments.Add(e);
                }
            }
            context.SaveChanges();
        }
 public ProfessorRepository(UniversityContext context) : base(context)
 {
     _context = context;
 }
 public CourseRepository(UniversityContext universityContext) : base(universityContext)
 {
     this.universityContext = universityContext;
 }
Exemple #20
0
 public PulpitsController(UniversityContext context)
 {
     _context = context;
 }
Exemple #21
0
 public EnrollmentRepository(UniversityContext universityContext)
 {
     this.ctx = universityContext;
 }
Exemple #22
0
 public ChartsController(UniversityContext context)
 {
     _context = context;
 }
Exemple #23
0
        public OfficeAssignmentRepository(UniversityContext universityContext) : base(universityContext)

        {
        }
Exemple #24
0
 public SpecialityRepository(UniversityContext context)
 {
     this.db = context;
 }
Exemple #25
0
 public CoursesController(UniversityContext db)
 {
     _db = db;
 }
Exemple #26
0
        public JsonResult GetCourses()
        {
            UniversityContext db = new UniversityContext();

            return(Json(db.Courses.ToList()));
        }
 public StudentsController(UniversityContext uc)
 {
     dbContext = uc;
 }
Exemple #28
0
 public StudentsController(UniversityContext context)
 {
     _context = context;
 }
 public UniversityRepository(UniversityContext context)
 {
     _context = context;
 }
 public InstructorRepo(UniversityContext context)
 {
     _context = context;
 }