// GET: t_areas/Edit/5 public ActionResult Edit(string id) { try { if (Session["UserRol"].ToString() == "Admin") { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } t_areas t_areas = db.t_areas.Find(id); if (t_areas == null) { return(HttpNotFound()); } return(View(t_areas)); } else { return(RedirectToAction("Index", "Home")); } } catch { return(RedirectToAction("Index", "Home")); } }
public ActionResult DeleteConfirmed(string id) { t_areas t_areas = db.t_areas.Find(id); db.t_areas.Remove(t_areas); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "area,descripcion")] t_areas t_areas) { if (ModelState.IsValid) { db.Entry(t_areas).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(t_areas)); }
public ActionResult Create([Bind(Include = "area,descripcion")] t_areas t_areas) { if (ModelState.IsValid) { t_areas.area = t_areas.area.ToUpper(); db.t_areas.Add(t_areas); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(t_areas)); }
// GET: t_areas/Details/5 public ActionResult Details(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } t_areas t_areas = db.t_areas.Find(id); if (t_areas == null) { return(HttpNotFound()); } return(View(t_areas)); }