コード例 #1
0
        public ApplicantsAndLessonsViewModel Search(ApplicantSerachViewModel searchModel, int?page)
        {
            var lessons = _dbContext.Lessons
                          .Include(l => l.Teacher)
                          .Include(l => l.Technology);

            var teachers     = _dbContext.Teachers;
            var technologies = _dbContext.Technologies;

            var applicants = _dbContext.GetApplicants();

            List <ApplicantInfoViewModel> applicantsIVM = applicants
                                                          .Filter(searchModel)
                                                          .GetAllApplicantIVM();

            int pageSize            = 15;
            var paginatedApplicants = PaginatedList <ApplicantInfoViewModel> .Create(
                applicantsIVM, page ?? 1, pageSize);

            ApplicantsAndLessonsViewModel model = ApplicantMapper.Mapping(
                paginatedApplicants, lessons, teachers, technologies,
                searchModel.FirstName, searchModel.LastName, searchModel.LessonId,
                searchModel.TeacherId, searchModel.TechnologyId, page);

            return(model);
        }
コード例 #2
0
        public IActionResult AllApplicants()
        {
            ApplicantSerachViewModel searchModel =
                ApplicantMapper.Mapping(string.Empty, string.Empty, 0, 0, 0);

            ApplicantsAndLessonsViewModel model = Search(searchModel, 1);

            return(View(model));
        }
コード例 #3
0
        public IActionResult AllApplicants(string firstName, string lastName,
                                           int lessonId, int teacherId, int technologyId, int?page)
        {
            ApplicantSerachViewModel searchModel =
                ApplicantMapper.Mapping(firstName, lastName, lessonId, teacherId, technologyId);

            ApplicantsAndLessonsViewModel model = Search(searchModel, page);

            return(View(model));
        }
コード例 #4
0
        public IActionResult Change(string firstName, string lastName,
                                    int lessonId, int teacherId, int technologyId, int page)
        {
            ApplicantSerachViewModel searchModel =
                ApplicantMapper.Mapping(firstName, lastName, lessonId, teacherId, technologyId);

            ApplicantsAndLessonsViewModel model = Search(searchModel, page);

            return(View("_ApplicantTablePartial", model));
        }
コード例 #5
0
        public static ApplicantsAndLessonsViewModel Mapping(
            PaginatedList <ApplicantInfoViewModel> paginatedApplicants,
            IEnumerable <Lesson> lessons, IEnumerable <Teacher> teachers,
            IEnumerable <Technology> technologies,
            string firstName, string lastName, int lessonId, int teacherId, int technologyId,
            int page)
        {
            ApplicantsAndLessonsViewModel model = new ApplicantsAndLessonsViewModel()
            {
                PaginatedApplicants = paginatedApplicants,
                Lessons             = Utilities.GetSelectListItem(lessons),
                Teachers            = Utilities.GetSelectListItem(teachers),
                Technologies        = Utilities.GetSelectListItem(technologies),
                FirstName           = firstName,
                LastName            = lastName,
                LessonId            = lessonId,
                TeacherId           = teacherId,
                TechnologyId        = technologyId,
                PageIndex           = page
            };

            return(model);
        }