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)); }
public ActionResult <PropertyImageDTO> GetPropertyImageById(int idPropertyImage) { PropertyImage propertyImage = _realStateAPIRepository.GetPropertyImageById(idPropertyImage); if (propertyImage == null) { return(NotFound()); } PropertyImageDTO propertyImageDTO = _mapper.Map <PropertyImageDTO>(propertyImage); return(propertyImageDTO); }