public HttpResponseMessage GetCategoryList() { //JsonData jd = new JsonData(bll.GetModelList("")); string tojson = JsonMapper.ToJson(bll.GetModelList("")); return(new HttpResponseMessage { Content = new StringContent(tojson) }); }
public void ProcessRequest(HttpContext context) { Leadin.BLL.Category bll = new BLL.Category(); context.Response.ContentType = "text/plain"; List <Model.Category> modelList = bll.GetModelList(""); var result = modelList.Select(m => new { id = m.Id, pId = m.ParentId, name = m.Title, open = false, target = "DeployBase", url = "/oasystem/oacategory/detail.aspx?dptid=" + m.Id.ToString(CultureInfo.InvariantCulture) }).ToList(); context.Response.Write(JsonMapper.ToJson(result)); }