public HttpResponseMessage Post() { VenusServiceResponse response = null; var context = HttpContext.Current.Request; string method = context.Form["method"].ToString(); switch (method) { case "jxdyf.search.list.get": response = new Search.ListService(); break; case "jxdyf.search.keywordlist.get": response = new Search.KeywordListService(); break; } IVenusService service = new DefaultJXService(); if (response != null) { response.ClientIP = context.UserHostAddress; response.NvParams = context.Form; return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(service.Execute(response), Encoding.UTF8, "text/javascript") }); } else { return(Request.CreateResponse(HttpStatusCode.OK)); } }
public HttpResponseMessage Get() { string str = string.Empty; var context = HttpContext.Current.Request; // string method = context["method"].ToString(); switch (method) { case "jxdyf.search.list.get": Search.ListService list = new Search.ListService(); str = list.ResultGet(); break; case "jxdyf.search.keywordlist.get": Search.KeywordListService keywordlist = new Search.KeywordListService(); str = keywordlist.ResultGet(); break; } return(new HttpResponseMessage(HttpStatusCode.OK) { Content = new StringContent(str, Encoding.UTF8, "text/javascript") }); }