// GET: Classes/Details/5
        public ActionResult Details(int id)
        {
            BusinessLayer.BusinessManager _bm = BusinessLayer.BusinessManager.GetInstance();
            Classe classe = _bm.GetClasseById(id);

            if (classe == null)
            {
                return(HttpNotFound());
            }

            List <Eleve>   eleves   = _bm.GetEleveByClasseId(id);
            List <EleveVM> eleveVMS = new List <EleveVM>();

            if (eleves != null)
            {
                foreach (var eleve in eleves)
                {
                    eleveVMS.Add(new EleveVM
                    {
                        Nom    = eleve.Nom,
                        Prenom = eleve.Prenom
                    });
                }
            }

            ClasseVM classeVM = new ClasseVM
            {
                NomEtablissement = classe.NomEtablissement,
                Eleves           = eleveVMS,
                Niveau           = classe.Niveau,
                ClasseId         = classe.ClasseId
            };

            return(View(classeVM));
        }
 public ActionResult Add(ClasseVM model)
 {
     if (ModelState.IsValid)
     {
         Classe classe = new Classe()
         {
             Eleves = new List <Eleve>(), Niveau = model.Niveau, NomEtablissement = model.NomEtablissement
         };
         Manager.Instance.AddClasse(classe);
         return(RedirectToAction("ClasseList", "Classe"));
     }
     return(View());
 }