public ActionResult Supprimer(int id)
        {
            AbonnementServiceAPI rsa = new AbonnementServiceAPI();
            AbonnementDetails    r   = new AbonnementDetails(rsa.Donner(id));

            return(View(r));
        }
        public ActionResult Index()
        {
            AbonnementServiceAPI          rs = new AbonnementServiceAPI();
            IEnumerable <AbonnementIndex> ri = rs.Donner().Select(j => new AbonnementIndex(j));

            return(View(ri));
        }
        public ActionResult Desactiver(int id)
        {
            AbonnementServiceAPI rsa = new AbonnementServiceAPI();
            bool b = rsa.Desactiver(id);

            return(RedirectToAction("Index"));
        }
        public ActionResult Modifier(int id)
        {
            AbonnementServiceAPI rs = new AbonnementServiceAPI();
            var test = rs.Donner(id);
            AbonnementModification r = new AbonnementModification(rs.Donner(id));

            return(View(r));
        }
        public ActionResult Details(int id)
        {
            AbonnementServiceAPI rsa = new AbonnementServiceAPI();
            /*!!??!!! pourquoi a est-il vide? à cause de decimal?)*/
            Abonnement        a  = rsa.Donner(id);
            AbonnementDetails ad = new AbonnementDetails(a);

            return(View(ad));
        }
 public ActionResult Creer(AbonnementCreation e)
 {
     if (ModelState.IsValid)
     {
         AbonnementServiceAPI rsa = new AbonnementServiceAPI();
         int i = rsa.Creer(e.VersAbonnement());
         if (i > 0)
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(e));
 }
 public ActionResult Supprimer(int id, AbonnementDetails r)
 {
     if (ModelState.IsValid)
     {
         AbonnementServiceAPI rsa = new AbonnementServiceAPI();
         bool b = rsa.Supprimer(id);
         if (b)
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(r));
 }
        public ActionResult Modifier(int id, AbonnementModification rm)
        {
            if (ModelState.IsValid)
            {
                AbonnementServiceAPI rsa = new AbonnementServiceAPI();
                Abonnement           r   = rm.VersAbonnement();
                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" }));
            }
        }