public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(View("NotFound"));
            }

            try
            {
                var accommodation = await service.FindAsync(id.Value);

                return(View(mapper.MapFrom(accommodation)));
            }
            catch (AccommodationNotFoundException)
            {
                return(View("NotFound"));
            }
        }
예제 #2
0
        public async Task <IActionResult> Details(Guid?id)
        {
            if (id == null)
            {
                return(View("NotFound"));
            }

            try
            {
                var facility = await facilityService.FindAsync(id.Value);

                var accommodations = await accommodationService.ListAsync(facility.Id);

                return(View(new FacilityDetailsViewModel
                {
                    Facility = facilityMapper.MapFrom(facility),
                    Accommodations = accommodationMapper.MapFrom(accommodations)
                }));
            }
            catch (FacilityNotFoundException)
            {
                return(View("NotFound"));
            }
        }