Example #1
0
        public ActionResult <PropertyImageDTO> AddPropertyImage([FromBody] PropertyImageDTO propertyImageCreation)
        {
            PropertyImage propertyImage = _mapper.Map <PropertyImage>(propertyImageCreation);

            _realStateAPIRepository.AddPropertyImage(propertyImage);
            _realStateAPIRepository.Save();

            PropertyImageDTO propertyImageDTO = _mapper.Map <PropertyImageDTO>(propertyImage);

            return(new CreatedAtRouteResult("GetPropertyImageById", new { idPropertyImage = propertyImage.IdPropertyImage }, propertyImageDTO));
        }
Example #2
0
        public ActionResult <PropertyImageDTO> GetPropertyImageById(int idPropertyImage)
        {
            PropertyImage propertyImage = _realStateAPIRepository.GetPropertyImageById(idPropertyImage);

            if (propertyImage == null)
            {
                return(NotFound());
            }

            PropertyImageDTO propertyImageDTO = _mapper.Map <PropertyImageDTO>(propertyImage);

            return(propertyImageDTO);
        }