示例#1
0
        public async Task <IActionResult> Index(int page = 1, int?SalaryRange = null, int?Department = null)
        {
            var vacancyCrud     = new VacancyCrud();
            var departmentCrud  = new DepartmentCrud();
            var salaryRangeCrud = new SalaryRangeCrud();

            var departments = await departmentCrud.FindAll();

            var salaryRange = await salaryRangeCrud.FindAll();

            var vacancies = await vacancyCrud.FindWithFilters(page, SalaryRange, Department);

            var viewModel = new HomepageViewModel
            {
                Department  = Department,
                SalaryRange = SalaryRange,
                Departments = departments.Select(x => new SelectListItem
                {
                    Value = x.Id.ToString(), Text = x.DepartmentName
                }).ToList(),
                SalaryRanges = salaryRange
                               .Select(x => new SelectListItem {
                    Value = x.Id.ToString(), Text = x.DisplayValue
                }).ToList(),
                Vacancies = vacancies
            };

            return(View(viewModel));
        }
示例#2
0
        public AdminController()
        {
            _departmentCrud           = new DepartmentCrud();
            _salaryRangeCrud          = new SalaryRangeCrud();
            _vacancyCrud              = new VacancyCrud();
            _applicationCrud          = new ApplicationCrud();
            _fullVacancyApplicantCrud = new FullVacancyApplicantCrud();

            _htmlSanitizer = new HtmlSanitizer();
        }