public async Task <IActionResult> List(Guid facilityId)
        {
            try
            {
                var accommodations = await service.ListAsync(facilityId);

                return(Ok(mapper.MapFrom(accommodations)));
            }
            catch (FacilityNotFoundException)
            {
                return(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"));
            }
        }