public async Task <AttachmentDto> UploadAttachment(IFormFile file, Guid guid, string comment = "") { Guard.ArgumentNotNull(file, "File cannot be null"); Guard.ArgumentNotNull(comment, "Comment can not be null but empty"); Guard.IsGreaterThanZero(file.Length); var s3FileInfo = await _awsS3Service.UploadFileAsync(_awsConfig.S3BucketForFiles, guid.ToString(), file); var attachmentId = CreateAttachmentProperties(s3FileInfo, comment); var attachmentDto = new AttachmentDto { Id = attachmentId, s3File = s3FileInfo }; return(attachmentDto); }
public async Task <NeptuneLoaderResponse> ImportGraph(IFormFile turtleFile, Uri graphName, bool overwriteExisting = false) { Guard.IsValidUri(graphName); CheckFileTypeForTtl(turtleFile); var fileUploadInfo = await _awsS3Service.UploadFileAsync(_awsConfig.S3BucketForGraphs, turtleFile); var graphExists = _graphRepo.CheckIfNamedGraphExists(graphName); if (graphExists && !overwriteExisting) { throw new GraphAlreadyExistsException(graphName); } var loaderResponse = await _neptuneLoader.LoadGraph(fileUploadInfo.S3KeyName, graphName); return(loaderResponse); }