Example #1
0
        public async Task <IActionResult> Index()
        {
            IEnumerable <Vacancy> vacancies = await _vacancy.Vacancies.ToListAsync();

            var model = vacancies.Select(vacancy => new ItemViewModel
            {
                Id            = vacancy.Id,
                Name          = vacancy.Name,
                Annotation    = vacancy.Annotation,
                Text          = vacancy.Text,
                NamesOfCities = _vacancy.GetCitiesInVacancy(vacancy.Id).Select(city => city.Name)
            });

            return(View(model));
        }