Exemplo n.º 1
0
        // GET: DRE/Details/5
        public ActionResult Details(int?id)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Dictionary <String, String> data = new Dictionary <string, string>();

            data["NumeroDRE"] = "" + id;
            DRE dre = new DRE();

            dre = dre.find_by_id(data);

            if (dre == null)
            {
                return(HttpNotFound());
            }
            return(View(dre));
        }
Exemplo n.º 2
0
        // GET: DRE/Edit/5
        public ActionResult Edit(int?id)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if ((Session["user"] as Utilisateur).EtatUser != "Superviseur")
            {
                return(RedirectToAction("InvalidAccess", "Home"));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Dictionary <String, String> data = new Dictionary <string, string>();

            data["NumeroDRE"] = "" + id;
            DRE d1 = new DRE();

            d1 = d1.find_by_id(data);
            if (d1 == null)
            {
                return(HttpNotFound());
            }
            return(View(d1));
        }
Exemplo n.º 3
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if ((Session["user"] as Utilisateur).EtatUser != "Superviseur")
            {
                return(RedirectToAction("InvalidAccess", "Home"));
            }

            try
            {
                Dictionary <String, String> data = new Dictionary <string, string>();
                data["NumeroDRE"] = "" + id;

                DRE d1 = new DRE();
                d1 = d1.find_by_id(data);
                d1.remove(data);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }