Exemple #1
0
 public async ValueTask DeleteDocumentAsync(DocumentGrpcContract request)
 {
     await ServiceLocator.TraderDocumentsPostgresRepository.DeleteAsync(request.TraderId, request.Id);
 }
Exemple #2
0
        public async ValueTask <GetDocumentContentGrpcResponse> DownloadDocumentAsync(DocumentGrpcContract request)
        {
            var document = await ServiceLocator.TraderDocumentsPostgresRepository
                           .GetDocumentsAsync(request.TraderId, request.Id);

            if (document == null)
            {
                return
                    new GetDocumentContentGrpcResponse
                    {
                        DocumentContent = null
                    }
            }
            ;

            var fileContent = await ServiceLocator.AzureBlobContainer.DownloadBlobAsync(document.FileName);

            var encodedFileContent = AesEncodeDecode.Decode(fileContent.ToArray(), ServiceLocator.EncodingKey);

            return(new GetDocumentContentGrpcResponse
            {
                DocumentContent = new TraderDocumentContentGrpcModel
                {
                    Mime = document.Mime,
                    Data = encodedFileContent,
                    FileName = document.FileName
                }
            });
        }