Im using datatable in my project mvc , i want display Categorie name in place of categorye id foreign key in table courses

Viewed 14

[HttpGet] public JsonResult GetData() {``

        ApplicationDbContext db =   new ApplicationDbContext();
        var course = db.Courses

            .Include(d=>d.Competences)

            .Include(d=>d.Sequences)
            .ToList().Select(p => new { Id = p.Id, Titre = p.Titre, ShortDescription = p.ShortDescription, Price = p.Price, CategorieId = p.CategorieId });
              

var query = from q in db.Courses join cat in db.Categories.AsEnumerable()

on q.CategorieId equals cat.Libelle
enter code here
                 return Json(new { data = course }, 

JsonRequestBehavior.AllowGet);

    }
0 Answers
Related