public UnitOfWork(SchoolDbContext context)
 {
     _context       = context;
     Students       = new StudentRepository(_context);
     Courses        = new CourseRepository(_context);
     StudentCourses = new StudentCourseRepository(_context);
 }
 public StudentUnitOfWork(string connectionString, string migrationAssemblyName)
     : base(connectionString, migrationAssemblyName)
 {
     StudentRepository       = new StudentRepository(_DbContext);
     CourseRepository        = new CourseRepository(_DbContext);
     StudentCourseRepository = new StudentCourseRepository(_DbContext);
 }
 public CategoryService(CategoryRepository categoryRepository, StudentCourseRepository studentCourseRepository,
                        CourseRepository courseRepository, ViewRepository viewRepository,
                        FeedbackRepository feedbackRepository, UserRepository userRepository)
 {
     this.categoryRepository      = categoryRepository;
     this.studentCourseRepository = studentCourseRepository;
     this.courseRepository        = courseRepository;
     this.viewRepository          = viewRepository;
     this.feedbackRepository      = feedbackRepository;
     this.userRepository          = userRepository;
 }
예제 #4
0
        public ServerInformation getStudentDetail(string message)
        {
            var    goodMessage   = message.Substring(0, message.Length - 1);
            var    pozCODStudent = goodMessage.IndexOf("CODStudent:");//11 caractere
            string CODEStudent   = goodMessage.Substring(11);

            StudentRepository studentRepository = new StudentRepository();

            serverInformation.student = studentRepository.GetStudentByCOD(CODEStudent);
            if (serverInformation.student != null)
            {
                StudentCourse studentCourse = new StudentCourse();
                studentCourse.StudentId = serverInformation.student.StudentId;
                studentCourse.CourseId  = serverInformation.course.CourseId;

                StudentCourseRepository studentCourseRepository = new StudentCourseRepository();
                serverInformation.studentCourse = studentCourseRepository.UpdateStudentCourse(studentCourse, serverInformation);
            }

            return(serverInformation);
        }
예제 #5
0
        public ActionResult ActionRequestEnrollment(int courseID)
        {
            try
            {
                int userID            = int.Parse(Session["userID"].ToString());
                var studentRepository = new StudentRepository();
                var student           = studentRepository.GetStudentByUserID(userID);


                var studentCourse = new BussinessLogic.Models.StudentCourse();
                studentCourse.StudentId         = student.StudentId;
                studentCourse.CourseId          = courseID;
                studentCourse.RequestEnrollment = 1;

                var studentCourseRepository = new StudentCourseRepository();
                studentCourseRepository.RequestEnrollment(studentCourse);

                return(RedirectToAction("AllCourses"));
            }
            catch
            {
                return(View());
            }
        }
 public StudentCoursesController(StudentCourseRepository studentCourseRepository, IMapper mapper)
 {
     this.studentCourseRepository = studentCourseRepository;
     this.mapper = mapper;
 }