public async Task <PropertyDto> SaveData(ImageRest imageRest) { var property = await propertyRepository.FindById(imageRest.PropertyId); if (property == null) { throw new Exception("Property Not Found"); } var pi = new PropertyImageDto { Id = imageRest.Id, ImageUrl = await imageHelper.UploadPhotoAsync(new MemoryStream(imageRest.ImageArray)), Property = property }; dataContext.PropertyImages.Add(pi); await dataContext.SaveChangesAsync(); return(property); }
public async Task <IActionResult> AddImageV2(ImageRest imageRest) { var data = await this._propertyApplication.SaveImage(imageRest); return(Ok(data)); }
internal async Task <PropertyWithOwner> SaveImage(ImageRest imageRest) { var data = await propertyImageRepository.SaveData(imageRest); return(Mapper.Map <PropertyWithOwner>(data)); }