예제 #1
0
        /// <summary>
        /// Метод отображает необходимые вакансии для различных ролей
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public ActionResult ShowVacancies(VacancyFilter filter, FetchOptions options)
        {
            var model = new VacancyListViewModel
            {
                Role = CurrentUser.Role
            };

            switch (CurrentUser.Role)
            {
            case Models.Role.Employer:
            {
                model.Vacancies = employerRepository.ShowMyVacancies(CurrentUser.Id, filter, options);
                return(View(model));
            }

            case Models.Role.Admin:
            {
                model.Vacancies = employerRepository.GetAllWithSort(options);
                return(View(model));
            }

            case Role.Jobseeker:
            {
                model.Vacancies = employerRepository.GetAllWithSort(options);
                return(View(model));
            }
            }
            return(View());
        }
예제 #2
0
        /// <summary>
        /// метод для получения вакансий, соответствующих критериям поиска
        /// </summary>
        /// <param name="selectedCompany"></param>
        /// <param name="selectedExperience"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public ActionResult GetSelectedItems(string selectedCompany, string selectedExperience, string name)
        {
            if (long.TryParse(selectedCompany, out long company) != true)
            {
                company = 0;
            }
            else
            {
                company = long.Parse(selectedCompany);
            }
            List <Experience> experiences = new List <Experience>();

            if (long.TryParse(selectedExperience, out long experience) != true)
            {
                experiences = null;
            }
            else
            {
                experiences.Add(experienceRepository.Load(long.Parse(selectedExperience)));
            }
            VacancyFilter filter = new VacancyFilter
            {
                CompanyName  = companyRepository.Load(company),
                Experience   = experiences,
                SearchString = name
            };
            IList <Vacancy> vacancies = employerRepository.GetVacanciesFiltered(filter);
            var             model     = new VacancyListViewModel
            {
                Vacancies = vacancies,
                Role      = CurrentUser.Role
            };

            return(PartialView("VacanciesTable", model));
        }
        public ActionResult Index(FetchOptions options)
        {
            var vacancies = vacancyRepository.GetAllVacancies(options);
            var model     = new VacancyListViewModel
            {
                Vacancies = vacancies
            };

            return(View(model));
        }
        public async Task <IActionResult> Vacancies(int page = 1, int?categoryId = null)
        {
            SetPageMetaData(new PageMetaData
            {
                Title = "Job",
                Url   = new Uri($"{_settings.WebSiteUrl}vacancies/{page}")
            });

            var model = new VacancyListViewModel
            {
                List       = await _service.GetVacancies(page),
                CategoryId = categoryId
            };

            return(View("~/Views/Home/Vacancies.cshtml", model));
        }
예제 #5
0
        /// <summary>
        /// Позволяет соискателю найти подходящую вакансию
        /// </summary>
        /// <returns></returns>
        public ActionResult FindVacancy()
        {
            var         exp  = jobseekerRepository.FindProfile(long.Parse(User.Identity.GetUserId())).Experience;
            List <long> list = new List <long>();

            foreach (var e in exp)
            {
                list.Add(e.Id);
            }
            var model = new VacancyListViewModel
            {
                Vacancies = employerRepository.FindSuitableVacancy(list)
            };

            return(View("ShowVacancies", "", model));
        }