예제 #1
0
        public async Task <ActionResult> AddAudio(IFormFile formFile)
        {
            var result = await _photoService.AddAudioAsync(formFile);

            if (result.Error != null)
            {
                return(BadRequest(result.Error));
            }
            var audio = new Audio
            {
                Url      = result.SecureUrl.AbsoluteUri,
                PublicId = result.PublicId
            };

            _audioRepository.Add(audio);

            if (await _audioRepository.SaveAll())
            {
                return(Ok(audio.Id));
            }

            return(BadRequest("Nie udało się dodać nagrania" + result.SecureUrl.AbsoluteUri));
        }