public ActionResult Editar(Tabla4ViewModdel model) { try { if (ModelState.IsValid) { using (examenEntities db = new examenEntities()) { var oTabla = db.Decanatoes.Find(model.Id); oTabla.Nombre = model.Nombre; oTabla.matricula = model.Matricula; oTabla.campus = (int)model.Campus; oTabla.queja = model.Queja; oTabla.Fecha = model.Fecha; oTabla.Estatus = model.Estatus; //Enum.GetName(typeof(/*enum estado estudiante*/), model.Estatus) caso de oTabla.Estatus sea string y model.Estatus un enum //Enum.Parse(typeof(/*enum estado estudiante*/), oTabla.Estatus), model.Estatus) caso de oTabla.Estatus sea enum y model.Estatus un string db.Entry(oTabla).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Redirect("/Decanato/")); } return(View()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult Editar(int Id) { Tabla4ViewModdel model = new Tabla4ViewModdel(); using (examenEntities db = new examenEntities()) { var oTabla = db.Decanatoes.Find(Id); model.Nombre = oTabla.Nombre; model.Matricula = oTabla.matricula; model.Campus = (Campus)oTabla.campus; model.Queja = oTabla.queja; model.Fecha = oTabla.Fecha; model.Estatus = oTabla.Estatus; model.Id = oTabla.Id; } return(View(model)); }