Exemplo n.º 1
0
        public ActionResult Index()
        {
            RoleServiceAPI          rs = new RoleServiceAPI();
            IEnumerable <RoleIndex> ri = rs.Donner().Select(j => new RoleIndex(j));

            return(View(ri));
        }
Exemplo n.º 2
0
        public ActionResult Supprimer(int id)
        {
            RoleServiceAPI  rsa = new RoleServiceAPI();
            RoleSuppression r   = new RoleSuppression(rsa.Donner(id));

            return(View(r));
        }
Exemplo n.º 3
0
        public ActionResult Desactiver(int id)
        {
            RoleServiceAPI rsa = new RoleServiceAPI();
            bool           b   = rsa.Desactiver(id);

            return(RedirectToAction("Index"));
        }
Exemplo n.º 4
0
        public ActionResult Details(int id)
        {
            RoleServiceAPI rsa = new RoleServiceAPI();
            Role           r   = rsa.Donner(id);
            RoleDetails    rd  = new RoleDetails(r);

            return(View(rd));
        }
Exemplo n.º 5
0
        public ActionResult Modifier(int id)
        {
            RoleServiceAPI   rs = new RoleServiceAPI();
            RoleModification r  = new RoleModification(rs.Donner(id));



            return(View(r));
        }
Exemplo n.º 6
0
        public ActionResult Creer(RoleCreation e)
        {
            if (ModelState.IsValid)
            {
                RoleServiceAPI rsa = new RoleServiceAPI();

                int i = rsa.Creer(e.VersRole());
                if (i > 0)
                {
                    return(RedirectToAction("Index"));
                }
            }
            return(View(e));
        }
Exemplo n.º 7
0
        public ActionResult Modifier(int id, RoleModification rm)
        {
            if (ModelState.IsValid)
            {
                RoleServiceAPI rsa = new RoleServiceAPI();
                Role           r   = rm.VersRole();
                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" }));
            }
        }
Exemplo n.º 9
0
        public ActionResult Supprimer(int id, RoleSuppression r)
        {
            RoleServiceAPI  rsa = new RoleServiceAPI();
            RoleSuppression rr  = new RoleSuppression(rsa.Donner(id));

            if (ModelState.IsValid)
            {
                //RoleServiceAPI rsa = new RoleServiceAPI();
                bool b = rsa.Supprimer(id);
                if (b)
                {
                    return(RedirectToAction("Index"));
                }
            }
            return(View("Error"));
        }