public ActionResult Nuevo(ListaSupervisores model) { try { if (ModelState.IsValid) { using (poligonoEntities db = new poligonoEntities()) { //string ePass = Encrypt.GetSHA256(contrasena); var oSupervisor = new supervisor(); oSupervisor.nombre_supervisor = model.nombre; db.supervisor.Add(oSupervisor); db.SaveChanges(); } return(Redirect("~/Supervisores/")); } return(View(model)); //return Redirect("/Rol"); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult Editar(int Idsupervisor) { ListaSupervisores model = new ListaSupervisores(); using (poligonoEntities db = new poligonoEntities()) { var oSupervisor = db.supervisor.Find(Idsupervisor); model.nombre = oSupervisor.nombre_supervisor; } return(View(model)); }
public ActionResult Editar(int Idsupervisor) { ListaSupervisores model = new ListaSupervisores(); using (Context db = new Context()) { var oSupervisor = db.Supervisor.Find(Idsupervisor); model.nombre = oSupervisor.nombre_supervisor; } return(View(model)); }
public ActionResult Editar(ListaSupervisores model) { try { if (ModelState.IsValid) { using (poligonoEntities db = new poligonoEntities()) { var oSupervisor = db.supervisor.Find(model.Idsupervisor); oSupervisor.nombre_supervisor = model.nombre; db.Entry(oSupervisor).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Redirect("~/Supervisores/")); } return(View(model)); //return Redirect("/Rol"); } catch (Exception ex) { throw new Exception(ex.Message); } }