public IEnumerable <Products> Get([FromBody] RequestResponse recievedResponse) { var requestvalidator = new Utility.RequestResponseValidation(); if (requestvalidator.IsGetProductRequestCorrect(recievedResponse)) { return(this._repository.GetAllProductsBasedOnQuestions(recievedResponse.ChoiceDictionary)); } else { return(new List <Products>() { new Products("Invalid GetProductRequest") }); } }
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); }