///示例一 [HttpPost] public ActionResult SearchEnt() { UserCheck(); string jsonStr = "{\"success\":true,\"message\":\"\"}"; string keyword = Request["data"]; if (!string.IsNullOrEmpty(keyword)) { EntinfoDAl EID = new EntinfoDAl(); List Entlist = db.EntInfoMation.Where(o => o.EntName.IndexOf(keyword) != -1 || o.OrgNo.IndexOf(keyword) != -1 || o.LicenceNo.IndexOf(keyword) != -1 || o.EntType.IndexOf(keyword) != -1).Take(10).ToList(); StringBuilder EfSb = new StringBuilder(); foreach (EntInfoMation ef in Entlist) { EfSb.Append("" + ef.EntName + "" + ef.OrgNo + "<" + ef.LicenceNo + "" + ef.EntType + ""); } jsonStr = "{\"success\":true,\"message\":\"" + EfSb + "\"}"; } return Content(jsonStr, "text/html;charset=UTF-8"); } //实例2 public ActionResult GetEntCertSortDicByTSN(string TSName) { string jsonStr = null; if (!string.IsNullOrEmpty(TSName)) { List list = ServicesLayout.Creater.ProductCreater.EntCertSortDicManager.GetAllEntCertSortDicByQuery("TopSortName=@0", new object[] { TSName }, "", false); jsonStr = JsonConvert.SerializeObject(list); } return Content(jsonStr, "text/html;charset=UTF-8"); }