Esempio n. 1
0
 public async Task <IActionResult> UploadVocabularyAudio([FromForm] IFormFile audio)
 {
     if (audio == null || audio.Length <= 0)
     {
         return(BadRequest());
     }
     return(Json(await _AppFileService.PostAudioUploadAsync(new RawAppFileDTO
     {
         Content = await audio.GetAllBytesAsync(),
         Name = audio.Name
     })));
 }
Esempio n. 2
0
 public async Task <IActionResult> UploadUserExamAudio([FromForm] IFormFile audio, [FromForm] string fname)
 {
     if (audio == null || audio.Length <= 0 || fname.IsNullOrEmpty())
     {
         return(BadRequest());
     }
     return(Json(await _AppFileService.PostAudioUploadAsync(new RawAppFileDTO
     {
         Content = await audio.GetAllBytesAsync(),
         Name = fname
     })));
 }
Esempio n. 3
0
        public virtual async Task <JsonResult> CreateAsync(IFormFile file)
        {
            if (file == null)
            {
                throw new UserFriendlyException("No file found!");
            }

            var bytes = await file.GetAllBytesAsync();

            var result = await FileAppService.CreateAsync(new FileUploadInputDto()
            {
                Bytes = bytes,
                Name  = file.FileName
            });

            return(Json(result));
        }