// GET: /GestionDesClasses/Classes public ActionResult ReadClasses() { IList <ClasseModels> models = new List <ClasseModels>(); using (ClasseRepository repository = new ClasseRepository()) { IQueryable <Classrooms> a = repository.All(); models = repository.All().Select(x => new ClasseModels { id = x.Id, title = x.Title, userId = x.User_Id, yearId = x.Year_Id, etablissementId = x.Establishment_Id }).ToList(); } return(View(models)); }