예제 #1
0
        public ActionResult Create(TechnicienDre tech, DRE dre)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if ((Session["user"] as Utilisateur).EtatUser != "Superviseur")
            {
                return(RedirectToAction("InvalidAccess", "Home"));
            }

            try
            {
                if (ModelState.IsValid)
                {
                    tech.dre = dre;
                    tech.save();
                    return(RedirectToAction("index"));
                }
            }
            catch
            {
            }

            return(View());
        }
예제 #2
0
        // GET: TechnicienDre/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["IdUser"] = "" + id;
            TechnicienDre tech = new TechnicienDre();

            tech = tech.find_by_id(data);

            if (tech == null)
            {
                return(HttpNotFound());
            }
            return(View(tech));
        }
예제 #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["IdUser"] = "" + id;
                TechnicienDre tech = new TechnicienDre();
                tech = tech.find_by_id(data);
                tech.remove(data);
                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
예제 #4
0
        // GET: TechnicienDre/Delete/5
        public ActionResult Delete(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["IdUser"] = "" + id;
            TechnicienDre tech = new TechnicienDre();

            tech = tech.find_by_id(data);
            if (tech == null)
            {
                return(HttpNotFound());
            }
            return(View(tech));
        }
예제 #5
0
        public ActionResult Edit(TechnicienDre tech, DRE _dre)
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if ((Session["user"] as Utilisateur).EtatUser != "Superviseur")
            {
                return(RedirectToAction("InvalidAccess", "Home"));
            }


            try
            {
                if (ModelState.IsValid)
                {
                    tech.dre = _dre;



                    tech.edit_by_id();
                    return(Content("" + _dre.NomDRE));
                    //return RedirectToAction("Index");
                }
                return(View(tech));
            }
            catch
            {
                return(View());
            }
        }
예제 #6
0
        // GET: TechnicienDre
        public ActionResult Index()
        {
            if (Session["user"] == null)
            {
                return(RedirectToAction("Index", "Home"));
            }
            if ((Session["user"] as Utilisateur).EtatUser != "Superviseur")
            {
                return(RedirectToAction("InvalidAccess", "Home"));
            }

            TechnicienDre tech = new TechnicienDre();

            return(View(tech));
        }