예제 #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);
        }
        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));
        }
        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));
        }
        public static List <ApplicantInfoViewModel> GetAllApplicantIVM(
            this IQueryable <Applicant> applicants)
        {
            List <ApplicantInfoViewModel> model = new List <ApplicantInfoViewModel>();

            foreach (var item in applicants)
            {
                model.Add(ApplicantMapper.Mapping(item));
            }
            return(model);
        }