private bool igualValores(int id , string nombre, AREAS area) { return id == area.ID_AREA && nombre == area.NOMBRE; }
public ActionResult Edit(int id, AREAS areas) { if (Session["MiUsuario"] != null && Session["MiTipo"] != null) { var query = (db.AREAS.Find(id)); if (query == null) { return this.HttpNotFound(); } if (!ModelState.IsValid) { return View(areas); } if (!TryUpdateModel(query, new string[] { "NOMBRE" })) { return View(areas); } try { db.SaveChanges(); return RedirectToAction("Index"); } catch (Exception ex) { ModelState.AddModelError("", ex); return View(areas); } } else { return RedirectToAction("Index", "Login"); } }