Esempio n. 1
0
        // GET: Admin
        public ActionResult Index()
        {
            Client admin = (Client)Session["user"];

            if (admin != null)
            {
                if (ConnexionBD.estAdmin(admin.Email, admin.password))
                {
                    return(View());
                }
                else
                {
                    return(RedirectToAction("Accueil", "Gestion/"));
                }
            }
            else
            {
                return(RedirectToAction("login", "Gestion"));
            }
        }
Esempio n. 2
0
        // GET: Admin/Create
        public ActionResult getCommandes()
        {
            Client admin = (Client)Session["user"];

            if (admin != null)
            {
                if (ConnexionBD.estAdmin(admin.Email, admin.password))
                {
                    List <getCommande> commandes = ConnexionBD.getCommandes();
                    return(View(commandes));
                }
                else
                {
                    return(RedirectToAction("Accueil", "Gestion/"));
                }
            }
            else
            {
                return(RedirectToAction("login", "Gestion/"));
            }
        }
Esempio n. 3
0
        public ActionResult setArticle(string op)
        {
            Client admin = (Client)Session["user"];

            if (admin != null)
            {
                if (ConnexionBD.estAdmin(admin.Email, admin.password))
                {
                    if (op.Equals("lvr"))
                    {
                        string Nom          = Request["nombk"];
                        string Auteur       = Request["Auteur"];
                        string date_edition = Request["date_edition"];
                        double prix         = double.Parse(Request["prix"]);
                        int    IdB          = int.Parse(Request["beblio"]);
                        string path         = Request["path"];

                        Livre livre = new Livre(Nom, Auteur, date_edition, prix, path, IdB);
                        ConnexionBD.setLivre(livre);
                    }
                    else if (op.Equals("cat"))
                    {
                        string Nom = Request["nombb"];
                        int    IdB = int.Parse(Request["idbb"]);

                        Categorie categorie = new Categorie(Nom, IdB);
                        ConnexionBD.setCategorie(categorie);
                    }
                    return(View());
                }
                else
                {
                    return(RedirectToAction("Accueil", "Gestion/"));
                }
            }
            else
            {
                return(RedirectToAction("login", "Gestion/"));
            }
        }
Esempio n. 4
0
        public ActionResult EstUser()
        {
            string email = Request["Email_l"];
            string pass  = Request["passl"];

            Client user = ConnexionBD.login(email, pass);

            if (user != null)
            {
                Session["user"] = user;
                if (ConnexionBD.estAdmin(user.Email, user.password))
                {
                    return(RedirectToAction("Index", "Admin/"));
                }

                else
                {
                    return(RedirectToAction("Accueil"));
                }
            }

            ViewBag.er = "Erreur ";
            return(RedirectToAction("login"));
        }