EF链表查询

 public ActionResult GetCourseList()
        {
            var mo = from e in gzhContext.WxCourseList.Select(m=>new { m.Id,m.Title,m.CourseName,m.Coursetype,m.StartTime, m.LiveNumber, m.Imgid,m.Status})
                     from f in gzhContext.CourseCover.Select(m=>new { m.ImgId,m.Img,m.Ext})
                     where e.Imgid == f.ImgId && e.StartTime >= DateTime.Now.AddDays(-1)
                     orderby e.Coursetype descending
                     select new
                     {
                         Id = e.Id,
                         Title = e.Title,
                         CourseName = e.CourseName,
                         Coursetype = e.Coursetype,
                         StartTime = Convert.ToDateTime(e.StartTime).ToString("yyyy-MM-dd HH:mm"),
                         LiveNumber = e.LiveNumber,
                         Imgid = e.Imgid,
                         Status = e.Status,
                         Img = f.Img,
                         Ext = f.Ext
                     };
            mo.ToList();
            return new JsonResult(0, mo);
        }

原文地址:https://www.cnblogs.com/aghk/p/12867525.html