예제 #1
0
        public List <string> GetSampleRequestResponse(string receivedresponse)
        {
            var sendResponse = new RequestResponse();
            //var layerAndResponse = new string[] { };
            var layerAndResponse = new List <string[]>();

            SuggestionPaths sub  = new SuggestionPaths();
            var             list = sub.NextLayer(receivedresponse);

            return(list);
            // layerAndResponse.Add(sub.layer1Members)


            //layerAndResponse.Append("Layer1");
            //for (int i = 0; i < 1; i++)
            //{
            //  layerAndResponse.Append("Layer1Response");
            //}

            //var suggestionPathObj = new SuggestionPaths();
            // sendResponse.layer = suggestionPathObj.NextLayer("Layer1");
            //sendResponse.layerMembers = suggestionPathObj.LayerMembers("Layer1Response");
            //sendResponse.choiceList.Append(layerAndResponse);

            //return sendResponse;

            //sendResponse.layerMembers.Add(layerAndResponse);
            //return layerAndResponse;
        }
        public RequestResponse GetNextQuestion([FromBody] RequestResponse recievedResponse)
        {
            var sendResponse     = new RequestResponse();
            var requestvalidator = new RequestResponseValidation();

            if (requestvalidator.IsRequestResponseCorrect(recievedResponse))
            {
                var suggestionPathObj = new SuggestionPaths();
                if (recievedResponse.Layer == "startLayer")
                {
                    sendResponse.Layer            = suggestionPathObj.NextLayer(recievedResponse.Layer);
                    sendResponse.LayerMembers     = suggestionPathObj.NextLayerMembers(new[] { sendResponse.Layer });
                    sendResponse.ChoiceDictionary = recievedResponse.ChoiceDictionary;
                    return(sendResponse);
                }
                else
                {
                    return(requestvalidator.getResponse(recievedResponse));
                }
            }
            else
            {
                sendResponse.Layer = "Invalid RequestResponse Sent";
                return(sendResponse);
            }
        }
예제 #3
0
        public RequestResponse GetNextQuestion([FromBody] RequestResponse recievedResponse)
        {
            var sendResponse      = new RequestResponse();
            var suggestionPathObj = new SuggestionPaths();

            sendResponse.Layer        = suggestionPathObj.NextLayer(recievedResponse.Layer);
            sendResponse.LayerMembers = suggestionPathObj.NextLayerMembers(recievedResponse.LayerMembers);

            sendResponse.ChoiceDictionary = recievedResponse.ChoiceDictionary;
            sendResponse.ChoiceDictionary.Add(recievedResponse.Layer, recievedResponse.LayerMembers);

            return(sendResponse);
        }
        public RequestResponse getResponse(RequestResponse recievedResponse)
        {
            var sendResponse      = new RequestResponse();
            var requestvalidator  = new RequestResponseValidation();
            var suggestionPathObj = new SuggestionPaths();

            if (requestvalidator.IsChoicesMade(recievedResponse.ChoiceDictionary[recievedResponse.Layer]))
            {
                sendResponse.Layer            = suggestionPathObj.NextLayer(recievedResponse.Layer);
                sendResponse.LayerMembers     = suggestionPathObj.NextLayerMembers(recievedResponse.ChoiceDictionary[recievedResponse.Layer]);
                sendResponse.ChoiceDictionary = recievedResponse.ChoiceDictionary;
                return(sendResponse);
            }
            else
            {
                sendResponse.Layer = "Invalid RequestResponse Sent";
                return(sendResponse);
            }
        }
예제 #5
0
        public RequestResponse GetNextQuestion([FromBody] RequestResponse recievedResponse)
        {
            var sendResponse     = new RequestResponse(new Dictionary <string, string[]> {
            }, new string[] { }, "");
            var requestvalidator = new Utility.RequestResponseValidation();

            if (requestvalidator.IsRequestResponseCorrect(recievedResponse))
            {
                var suggestionPathObj = new SuggestionPaths();
                sendResponse.Layer            = suggestionPathObj.NextLayer(recievedResponse.Layer);
                sendResponse.LayerMembers     = suggestionPathObj.NextLayerMembers(recievedResponse.LayerMembers);
                sendResponse.ChoiceDictionary = recievedResponse.ChoiceDictionary;
                sendResponse.ChoiceDictionary.Add(recievedResponse.Layer, recievedResponse.LayerMembers);
            }
            else
            {
                sendResponse.Layer = "Invalid RequestResponse Sent";
            }

            return(sendResponse);
        }