public TReturnType ProcessFileDownload <TReturnType, TParameterType>(TParameterType downloadFileParameters) where TReturnType : SitefinityCommonFileHandlerResponseModelBase where TParameterType : SitefinityCommonFileHandlerRequestModelBase { if (typeof(TReturnType) != typeof(S3SitefinityCommonFileHandlerResponse) && typeof(TParameterType) != typeof(S3SitefinityCommonFilehandlerRequest)) { throw new ArgumentException(); } S3SitefinityCommonFilehandlerRequest fileDownloadRequest = downloadFileParameters as S3SitefinityCommonFilehandlerRequest; S3DownloadedFile file = DownloadFileFromS3(fileDownloadRequest.ProviderName, fileDownloadRequest.LibraryName, fileDownloadRequest.FileName); return(new S3SitefinityCommonFileHandlerResponse { FileStream = file.FileStream, FileHandlerServiceType = SitefinityCommonFileHandlerServiceType.S3 } as TReturnType); }
public TReturnType ProcessFileUpload <TReturnType, TParameterType>(TParameterType uploadFileParameters) where TReturnType : SitefinityCommonFileHandlerResponseModelBase where TParameterType : SitefinityCommonFileHandlerRequestModelBase { if (typeof(TReturnType) != typeof(S3SitefinityCommonFileHandlerResponse) && typeof(TParameterType) != typeof(S3SitefinityCommonFilehandlerRequest)) { throw new ArgumentException(); } S3SitefinityCommonFilehandlerRequest filehandlerRequest = uploadFileParameters as S3SitefinityCommonFilehandlerRequest; bool success; success = UploadFileToS3(filehandlerRequest.MasterDocumentId, filehandlerRequest.ProviderName, filehandlerRequest.LibraryName, filehandlerRequest.FileName, filehandlerRequest.FileStream); return(new S3SitefinityCommonFileHandlerResponse { FileHandlerServiceType = SitefinityCommonFileHandlerServiceType.S3, FileSuccessStatus = success } as TReturnType); }