public HttpResponseMessage Post(SearchString searchString) { try { SearchQueryResponse resp = LUISAdapter.GetSearchQuery(searchString.Query); if (!String.IsNullOrEmpty(resp.SearchQuery)) { List <DisplayOrder> orders = new List <DisplayOrder>(); using (MySqlConnection conn = DBUtils.GetConnection()) { DisplayOrderHistoryRepository repo = new DisplayOrderHistoryRepository(conn); orders = repo.GetByQuery(resp.SearchQuery).ToList <DisplayOrder>(); } return(Request.CreateResponse(HttpStatusCode.OK, orders)); } return(Request.CreateResponse(HttpStatusCode.OK, new List <DisplayOrder>())); } catch (Exception ex) { return(Request.CreateResponse(HttpStatusCode.OK, ex.Message)); } }
public static SearchQueryResponse GetSearchQuery(string searchString) { string rawJSON = GetRawResponse(searchString); if (!String.IsNullOrEmpty(rawJSON)) { LUISResponse luisResp = JsonConvert.DeserializeObject <LUISResponse>(rawJSON); SearchQueryResponse resp = new SearchQueryResponse(); resp.RawJSON = rawJSON; resp.SearchQuery = getSearchQuery(luisResp); return(resp); } return(new SearchQueryResponse()); }
public ActionResult Search(string searchString) { SearchQueryResponse resp = LUISAdapter.GetSearchQuery(searchString); return(View(resp)); }