Exemplo n.º 1
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));
        }