public async Task <long> PostBulkuploadFile(string url, BulkUploadFileRequest bulkUploadFileRequest)
        {
            var data    = JsonConvert.SerializeObject(bulkUploadFileRequest);
            var content = await PostAsync(url, data);

            return(JsonConvert.DeserializeObject <long>(content));
        }
コード例 #2
0
        public async Task <long> BulkUploadFile(long providerId, BulkUploadFileRequest bulkUploadFileRequest)
        {
            // ToDo: Do we need the commitment id?
            var url = $"{_configuration.BaseUrl}api/provider/{providerId}/bulkupload";

            return(await _commitmentHelper.PostBulkuploadFile(url, bulkUploadFileRequest));
        }
コード例 #3
0
        public async Task <long> PostBulkUploadFile(long providerId, BulkUploadFileRequest bulkUploadFile)
        {
            _logger.Trace($"Saving bulk upload file for provider {providerId} ", providerId: providerId);

            var result = await _mediator.SendAsync(
                new CreateBulkUploadCommand
            {
                Caller         = new Caller(providerId, CallerType.Provider),
                ProviderId     = providerId,
                CommitmentId   = bulkUploadFile.CommitmentId,
                FileName       = bulkUploadFile.FileName,
                BulkUploadFile = bulkUploadFile.Data
            });

            _logger.Info($"Saved bulk upload for provider {providerId}", providerId: providerId);
            return(result);
        }
        public async Task <long> Handle(SaveBulkUploadFileCommand message, CancellationToken cancellationToken)
        {
            var validationResult = _validator.Validate(message);

            if (!validationResult.IsValid)
            {
                throw new ValidationException(validationResult.Errors);
            }

            var request = new BulkUploadFileRequest
            {
                CommitmentId = message.CommitmentId,
                Data         = message.FileContent,
                FileName     = message.FileName
            };

            return(await _commitmentsApi.BulkUploadFile(message.ProviderId, request));
        }
コード例 #5
0
        public async Task <IHttpActionResult> BulkUploadFile(long providerId, [FromBody] BulkUploadFileRequest bulkUploadFile)
        {
            var bulkUploadFileId = await _providerOrchestrator.PostBulkUploadFile(providerId, bulkUploadFile);

            return(CreatedAtRoute("GetBulkUploadFile", new { providerId, bulkUploadFileId }, bulkUploadFileId));
        }