///示例一
[HttpPost]
public ActionResult SearchEnt()
{
UserCheck();
string jsonStr = "{\"success\":true,\"message\":\"\"}";
string keyword = Request["data"];
if (!string.IsNullOrEmpty(keyword))
{
EntinfoDAl EID
= new EntinfoDAl
();
List<EntInfoMation> 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("<tr><td><a href='/Entinfo/Details/" + ef.EntID + "'>" + ef.EntName + "</a></td><td>" + ef.OrgNo + "</td><<td>" + ef.LicenceNo + "</td><td>" + ef.EntType + "</td></tr>");
}
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
<ServicesLayout
.ProductServiceReference.EntCertSortDic> list
= ServicesLayout
.Creater.ProductCreater.EntCertSortDicManager.GetAllEntCertSortDicByQuery("TopSortName=@0",
new object[] { TSName
},
"",
false);
jsonStr = JsonConvert.SerializeObject(list);
}
return Content(jsonStr, "text/html;charset=UTF-8");
}