Beispiel #1
0
        public async Task <dynamic> Post()
        {
            string userId = Request.Query
                            .SingleOrDefault(q => string.Compare(q.Key, "userId", StringComparison.OrdinalIgnoreCase) == 0)
                            .Value;

            if (string.IsNullOrEmpty(userId))
            {
                return(BadRequest("Provide a user id"));
            }

            var requestBody = new StreamReader(Request.Body).ReadToEnd();

            if (string.IsNullOrEmpty(requestBody))
            {
                return(BadRequest("Missing request body"));
            }

            try
            {
                return(await _crudService.CreateAudioUrlAsync(userId, requestBody));
            }
            catch (Exception e)
            {
                _logger.LogError("Create Audio Url Failed " + e);
                return(BadRequest(e.Message));
            }
        }