Esempio n. 1
0
        public ActionResult Supprimer(int id)
        {
            ThemeServiceAPI rsa = new ThemeServiceAPI();
            ThemeDetails    r   = new ThemeDetails(rsa.Donner(id));

            return(View(r));
        }
Esempio n. 2
0
        public ActionResult Modifier(int id)
        {
            ThemeServiceAPI   rs = new ThemeServiceAPI();
            ThemeModification r  = new ThemeModification(rs.Donner(id));

            return(View(r));
        }
Esempio n. 3
0
        public ActionResult Index()
        {
            ThemeServiceAPI          rs = new ThemeServiceAPI();
            IEnumerable <ThemeIndex> ri = rs.Donner().Select(j => new ThemeIndex(j));

            return(View(ri));
        }
Esempio n. 4
0
        public ActionResult Desactiver(int id)
        {
            ThemeServiceAPI rsa = new ThemeServiceAPI();
            bool            b   = rsa.Desactiver(id);

            return(RedirectToAction("Index"));
        }
Esempio n. 5
0
        public ActionResult Details(int id)
        {
            ThemeServiceAPI rsa = new ThemeServiceAPI();
            Theme           r   = rsa.Donner(id);
            ThemeDetails    rd  = new ThemeDetails(r);

            return(View(rd));
        }
Esempio n. 6
0
 public ActionResult Creer(ThemeCreation e)
 {
     if (ModelState.IsValid)
     {
         ThemeServiceAPI rsa = new ThemeServiceAPI();
         int             i   = rsa.Creer(e.VersTheme());
         if (i > 0)
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(e));
 }
Esempio n. 7
0
 public ActionResult Supprimer(int id, ThemeDetails r)
 {
     if (ModelState.IsValid)
     {
         ThemeServiceAPI rsa = new ThemeServiceAPI();
         bool            b   = rsa.Supprimer(id);
         if (b)
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(r));
 }
Esempio n. 8
0
        public ActionResult Modifier(int id, ThemeModification rm)
        {
            if (ModelState.IsValid)
            {
                ThemeServiceAPI rsa = new ThemeServiceAPI();
                Theme           r   = rm.VersTheme();
                bool            b   = rsa.Modifier(id, r);
                if (b)
                {
                    return(RedirectToAction("Index"));
                }
            }

            return(View(rm));
        }
        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" }));
            }
        }