public ActionResult Desactiver(int id) { NouvelleServiceAPI rsa = new NouvelleServiceAPI(); bool b = rsa.Desactiver(id); return(RedirectToAction("Index")); }
public ActionResult Index() { NouvelleServiceAPI rs = new NouvelleServiceAPI(); IEnumerable <NouvelleIndex> ri = rs.Donner().Select(j => new NouvelleIndex(j)).OrderByDescending(k => k.id); return(View(ri)); }
public ActionResult Details(int id) { NouvelleServiceAPI rsa = new NouvelleServiceAPI(); Nouvelle r = rsa.Donner(id); NouvelleDetails rd = new NouvelleDetails(r); return(View(rd)); }
public ActionResult Creer(NouvelleCreation e) { if (ModelState.IsValid) { NouvelleServiceAPI rsa = new NouvelleServiceAPI(); e.idCreateur = SessionUtilisateur.Utilisateur.id; e.dateCreation = DateTime.Now; int i = rsa.Creer(e.VersNouvelle()); if (i > 0) { return(RedirectToAction("Index")); } } return(View(e)); }
private void Machin(ActionExecutingContext contexteFiltre) { string nomControleur = (string)contexteFiltre.RouteData.Values["controller"]; int id = int.Parse((string)contexteFiltre.RouteData.Values["id"]); bool b = false; string ch = (_modele == null) ? nomControleur.ToLower() : _modele; switch (nomControleur.ToLower()) { case "role": b = new RoleServiceAPI().Donner(id) != null; break; case "personne": b = new PersonneServiceAPI().Donner(id) != null; break; case "utilisateur": b = new UtilisateurServiceAPI().Donner(id) != null; break; case "abonnement": b = new AbonnementServiceAPI().Donner(id) != null; break; case "arbre": b = new ArbreServiceAPI().Donner(id) != null; break; case "nouvelle": b = new NouvelleServiceAPI().Donner(id) != null; break; case "theme": b = new ThemeServiceAPI().Donner(id) != null; break; default: b = false; break; } if (!b) { contexteFiltre.Result = new RedirectToRouteResult (new RouteValueDictionary(new { Area = "", Controller = nomControleur, Action = "Index" })); } }