Exemplo n.º 1
0
        public async Task <IActionResult> AmenitiesGet()
        {
            var amenities = await _service.DevHub_Amenities_Get();

            foreach (AmenitiesForListModel am in amenities)
            {
                am.Rates = await _service.DevHub_AmenityRates_Get(am.AmenityId);
            }

            return(Ok(new { data = amenities }));
        }
Exemplo n.º 2
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."));
        }