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)); }
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 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); }