public async Task <IActionResult> Create(Guid id)
        {
            try
            {
                var accommodation = await accommodationService.FindAsync(id);

                ViewBag.FacilityId        = accommodation.FacilityId;
                ViewBag.AccommodationId   = accommodation.Id;
                ViewBag.AccommodationName = accommodation.Details.Name;
                return(View());
            }
            catch (AccommodationNotFoundException)
            {
                return(View("NotFound"));
            }
        }
示例#2
0
        public async Task <IActionResult> Details(Guid?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"));
            }
        }
        public async Task <FileAccessToken> IssueAccommodationImageUploadTokenAsync(Guid accommodationId, string originalFileName)
        {
            var accommodation = await accommodationService.FindAsync(accommodationId);

            var fileName = GenerateName(originalFileName);
            var path     = ConstructPath(accommodation.FacilityId, accommodation.Id, fileName);

            return(IssueImageUploadToken(path));
        }
        public async Task <IActionResult> Find(Guid id)
        {
            try
            {
                var accommodation = await service.FindAsync(id);

                return(Ok(mapper.MapFrom(accommodation)));
            }
            catch (AccommodationNotFoundException)
            {
                return(NotFound());
            }
        }