Beispiel #1
0
        private async Task UploadFileAsync(string objectToUpload, int objectId)
        {
            var request = await HttpContext.Request.ReadFormAsync();

            if (request.Files == null)
            {
                throw new Exception("Could not upload files");
            }

            var files = request.Files;

            if (files.Count == 0)
            {
                throw new Exception("Could not upload files");
            }

            switch (objectToUpload)
            {
            case StepVideo:
                await _azureBlobService.UploadStepVideoAsync(files, objectId);

                break;

            case StepLanguageAudio:
                await _azureBlobService.UploadStepLanguageAudioAsync(files, objectId);

                break;

            case TutorialThumbnail:
                await _azureBlobService.UploadTutorialThumbnailAsync(files, objectId);

                break;
            }
        }