Example #1
0
        public FileUploadModule(IRootPathProvider rootPathProvider, IApplicationSettings applicationSettings, IUploadNotificationService uploadNotificationService)
            : base("/file")
        {
            this.rootPathProvider = rootPathProvider;
            this.applicationSettings = applicationSettings;
            this.uploadNotificationService = uploadNotificationService;

            Post["/upload"] = parameters =>
            {
                if (!this.Principal.HasClaim(ConnectRClaimTypes.Admin))
                {
                    return HttpStatusCode.Forbidden;
                }

                FileUploadRequest request = this.BindAndValidate<FileUploadRequest>();
                FileUploadResponse response = StoreImage(request);

                uploadNotificationService.OnFileUploaded(response.Id);

                return Negotiate
                    .WithStatusCode(HttpStatusCode.OK)
                    .WithModel(response);
            };
        }
Example #2
0
 public DocumentBlobStorageService(IUploadNotificationService uploadNotificationService, IConfiguration configuration)
 {
     _uploadNotificationService = uploadNotificationService;
     _configuration             = configuration;
 }