Exemplo 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
     })));
 }
Exemplo 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
     })));
 }
Exemplo 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));
        }