public async Task <PhotoViewDTO> Edit(EditPhotoDTO editPhotoDTO)
        {
            await _photoService.EditPhotoAsync(editPhotoDTO);

            string userId = _authService.GetCurrentUserId();

            _eventBus.Publish(new PhotosModifiedEvent(userId, new[] { editPhotoDTO.Id }));

            return(await _photoService.GetPhotoOrDefaultAsync(editPhotoDTO.Id));
        }
Exemple #2
0
        public async Task EditPhotoAsync(EditPhotoDTO editPhotoDTO)
        {
            PhotoDocument photoDocument = await _elasticService.GetPhotoOrDefaultAsync(editPhotoDTO.Id);

            await ClearAllBlobsExceptOriginalIfExistsAsync(new PhotoDocument[] { photoDocument });

            photoDocument.BlobName = await _blobStorage.UploadFileAsync(editPhotoDTO.Base64Image);

            await _elasticService.UpdatePhotoAsync(editPhotoDTO.Id, photoDocument);
        }