// GET: Formation public ActionResult ToutesLesFormations() { List <Formation> listFormations = new List <Formation>(); using (var context = new WebApEntities()) { listFormations = context.Formation.ToList(); } return(View(listFormations)); }
public ActionResult DetailFormation(string nomSeo) { var vm = new FormationAvisViewModel(); using (var context = new WebApEntities()) { var formationEntity = context.Formation.Where(f => f.NomSeo == nomSeo).FirstOrDefault(); if (formationEntity == null) { return(RedirectToAction("Accueil", "Home")); } vm.FormationNom = formationEntity.Nom; vm.FormationDescription = formationEntity.Description; vm.FormationNomSeo = nomSeo; vm.FormationUrl = formationEntity.Url; vm.Note = formationEntity.Avis; } return(View()); }