qq_42128219 2019-10-07 12:39 采纳率: 0%
浏览 314

layui怎样处理这样的数据,我这个显示不了啊

public ActionResult GetResult(int page, int limit, string ID, string Name)
{
//找到数据库中的表staffJob
//var list = from a in oSMS.Staff
// select a;

        var list = from c in oSMS.Staff
                   join p in oSMS.Job
                   on c.JobId equals p.Id
                   select new { c, p };


        if (!string.IsNullOrEmpty(ID))
        {
            list = list.Where(x => x.c.No.Contains(ID));
        }
        if (!string.IsNullOrEmpty(Name))
        {
            list = list.Where(x => x.c.Name.Contains(Name));
        }
        int offset = limit * (page - 1);
        var data = list.OrderBy(x => x.c.Name).Skip(offset).Take(limit).ToList();
        var json = new
        {
            code = 0,
            msg = "",
            count = list.ToList().Count,
            data = data,
        };
        return Json(json, JsonRequestBehavior.AllowGet);
  }
  • 写回答

1条回答 默认 最新

  • zqbnqsdsmd 2019-10-07 16:35
    关注
    评论

报告相同问题?