コード例 #1
0
        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);
            }
        }
コード例 #2
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);
        }
コード例 #3
0
        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);
            }
        }
コード例 #4
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);
        }