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()); }
// 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)); }
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()); } }
// 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)); }
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()); } }
// 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)); }