{tabs-pane label="解决方式一"}
代码语言:javascript复制解决方式一:
var json = new { total = data.Count(), rows = result };
JsonSerializerSettings jsSettings = new JsonSerializerSettings();
jsSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
return JsonConvert.SerializeObject(json, jsSettings);
{/tabs-pane} {tabs-pane label="解决方式二"}
代码语言:javascript复制 var data = from a in db.Approver
where a.ProcessItemId == strId
select new ApproverViewModels
{
Id = a.Id,
JobCode = a.JobCode,
AreaLeve = a.AreaLeve,
Discrible = a.Discrible,
Order = a.Order,
ProcessItemId = a.ProcessItemId,
ExecuteMethod = a.ExecuteMethod,
};
var result = data.OrderBy(x => x.Order).Skip(offset).Take(limit).ToList();
var json = new { total = data.Count(), rows = result };
return Json(json, JsonRequestBehavior.AllowGet);
{/tabs-pane}
本文共 15 个字数,平均阅读时长 ≈ 1分钟