public async Task <IActionResult> Post([FromBody] GoogleCloudDialogflowV2WebhookRequest intent)
        {
            WebhookResponse returnValue = null;

            returnValue = await _obtainGoodInvestments.SelectRandomGoodFirms();

            if (returnValue == null)
            {
                returnValue = new WebhookResponse
                {
                    FulfillmentText = Utilities.ErrorReturnMsg() + Utilities.EndOfCurrentRequest()
                };
            }
            else if (returnValue.FulfillmentMessages.Count == 0 &&
                     !returnValue.FulfillmentText.Contains(Utilities.EndOfCurrentRequest()))
            {
                returnValue.FulfillmentText = returnValue.FulfillmentText + "\n" + Utilities.EndOfCurrentRequest();
            }
            var responseString = returnValue.ToString();

            _log.LogTrace("Completed processing request");
            return(new ContentResult
            {
                Content = responseString,
                ContentType = "application/json",
                StatusCode = 200
            });
        }
예제 #2
0
        public async Task <IActionResult> PostAsync([FromBody] Recommendations recommendations)
        {
            _logger.LogInformation("Starting Recommendations request");
            string randomRecommendations = await _obtainGoodInvestments.SelectRandomGoodFirms();

            IAppResponse appResponse = new AppResponse
            {
                ResponseData      = randomRecommendations,
                IsResponseSuccess = !randomRecommendations.IsNullOrWhiteSpace()
            };

            return(Ok(appResponse));
        }