Example #1
0
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var vacancy = await _vacancy.FindByIdAsync((int)id);

            if (vacancy == null)
            {
                return(NotFound());
            }

            return(View(new ItemViewModel
            {
                Id = vacancy.Id,
                Name = vacancy.Name,
                Annotation = vacancy.Annotation,
                Text = vacancy.Text,
                NamesOfCities = await _vacancy.GetCitiesInVacancy(vacancy.Id).Select(city => city.Name).ToListAsync()
            }));
        }