Exemplo n.º 1
0
        public async Task <IActionResult> AddPhotoForAmenity(PhotoForCreationModel photoModel)
        {
            var amenity = await _amenityService.DevHub_Amenities_Get(photoModel.ReferenceID);

            if (amenity == null)
            {
                return(NotFound("Could not find amenity."));
            }

            var result = await _photoService.AddPhotoForAmenity(photoModel);

            if (result != null)
            {
                return(CreatedAtRoute("GetPhoto", new { id = result.PhotoID }, result));
            }

            return(BadRequest("Could not add the photo."));
        }