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.CreateTextAsync(userId, requestBody)); } catch (Exception e) { _logger.LogError("Create Text Failed " + e); return(BadRequest(e.Message)); } }