Exemplo n.º 1
0
        public IActionResult LocationSummary(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var locationToBeSummarized = _LocationService.GetById((int)id);

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

            var locationSummaryModel = new LocationSummaryModel()
            {
                Location = locationToBeSummarized,
                CategoriesOfThisLocation  = _LocationService.GetLocationWithCategoriesById((int)id).LocationCategoryJunctions.Select(s => s.Category).ToList(),
                ExperiencesOfThisLocation = _ExperienceService.GetExperiencesWithCategoriesByLocationId((int)id),
                LastTravelersHere         = _ExperienceService.GetAll().Where(e => e.LocationId == (int)id).Take(3).Select(e => e.Author).ToList()
            };

            return(View(locationSummaryModel));
        }