public async Task <ActionResult <AudioFileDTO> > Upload([FromForm] AudioFileDTO audioFileDTO)
        {
            await _administrationMicroservice.UploadAudioAsync(audioFileDTO);

            var urlOfAudioFile = HttpContext.Request.Host.Value + "/audio/" + audioFileDTO.File.FileName;

            return(Created(urlOfAudioFile, audioFileDTO));
        }
        public async Task UploadWaitingAudioAsync(AudioFileDTO audioFileDTO)
        {
            var audio = _mapper.Map <AudioFileDTO, Audio>(audioFileDTO);

            audio.FileName = "waiting.mp3";

            await _audioService.UploadAsync(audio, audioFileDTO);
        }
예제 #3
0
        public async Task UploadAsync(Audio audio, AudioFileDTO audioFileDTO)
        {
            using (var memStream = new MemoryStream())
            {
                audioFileDTO.File.CopyTo(memStream);

                audio.AudioFile = memStream.ToArray();

                if (audio.FileName != "waiting.mp3")
                {
                    audio.FileName = audioFileDTO.File.FileName;
                }
            }

            var path = Path.Combine(_audioFilesFolderPath, audio.FileName);

            await _fileSystemRepository.WriteToFileSystemAsync(audio, path);
        }
        public async Task UploadAudioAsync(AudioFileDTO audioFileDTO)
        {
            var audio = _mapper.Map <AudioFileDTO, Audio>(audioFileDTO);

            await _audioService.UploadAsync(audio, audioFileDTO);
        }