Пример #1
0
        public async Task <ExtractFromUPUDocumentsDTO> AddDocumentAsync(ExtractFromUPUDocumentsDTO ExtractFromUPUDocumentsDTO)
        {
            var fileBase64 = ExtractFromUPUDocumentsDTO.BlobName.Split(',')[1];
            var extension  = "." + ExtractFromUPUDocumentsDTO.FileName.Split('.').LastOrDefault();
            var fileName   = Guid.NewGuid() + extension;
            await _blankFilesBlobStorage.UploadBlobForBase64Async(fileBase64, fileName);

            ExtractFromUPUDocumentsDTO.BlobName = fileName;

            var document = _mapper.Map <ExtractFromUPUDocumentsDTO, ExtractFromUPUDocuments>(ExtractFromUPUDocumentsDTO);

            _repositoryWrapper.ExtractFromUPUDocumentsRepository.Attach(document);
            await _repositoryWrapper.ExtractFromUPUDocumentsRepository.CreateAsync(document);

            await _repositoryWrapper.SaveAsync();

            return(ExtractFromUPUDocumentsDTO);
        }
Пример #2
0
        public async Task <IActionResult> AddExtractFromUPUDocument(ExtractFromUPUDocumentsDTO extractFromUPUDocumentsDTO)
        {
            await _blankExtractFromUPUDocumentService.AddDocumentAsync(extractFromUPUDocumentsDTO);

            return(Created("", extractFromUPUDocumentsDTO));
        }