Beispiel #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
     })));
 }
Beispiel #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
     })));
 }
Beispiel #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));
        }