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(TablaViewModel model) { try { if (ModelState.IsValid) { using (examenEntities db = new examenEntities()) { var oTabla = db.quejas.Find(model.Id); oTabla.Nombre = model.Nombre; oTabla.matricula = model.Matricula; oTabla.campus = (int)model.Campus; oTabla.queja1 = model.Queja; oTabla.fecha = model.Fecha; db.Entry(oTabla).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(Redirect("/Complain/")); } return(View()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult Nuevo(TablaViewModel model) { try { if (ModelState.IsValid) { using (examenEntities db = new examenEntities()) { var oTabla = new queja { Nombre = model.Nombre, matricula = model.Matricula, campus = (int)model.Campus, queja1 = model.Queja, fecha = model.Fecha }; db.quejas.Add(oTabla); db.SaveChanges(); } return(Redirect("/Complain/")); } return(View()); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult Eliminar(int Id) { using (examenEntities db = new examenEntities()) { var oTabla = db.quejas.Find(Id); db.quejas.Remove(oTabla); db.SaveChanges(); } return(Redirect("/Complain/")); }
public ActionResult Eliminar(int Id) { using (examenEntities db = new examenEntities()) { var oTabla = db.Estudiantes.Find(Id); db.Estudiantes.Remove(oTabla); db.SaveChanges(); } return(Redirect("/Students/")); }
public ActionResult Editar(int Id) { TablaViewModel model = new TablaViewModel(); using (examenEntities db = new examenEntities()) { var oTabla = db.quejas.Find(Id); model.Nombre = oTabla.Nombre; model.Matricula = oTabla.matricula; model.Campus = (Campus)oTabla.campus; model.Queja = oTabla.queja1; model.Fecha = oTabla.fecha; model.Id = oTabla.Id; } return(View(model)); }
public ActionResult Mover5(int Id) { using (examenEntities db = new examenEntities()) { var foundRecord = db.quejas.Find(Id); var typeCastRecord = new Equipo(); typeCastRecord.Nombre = foundRecord.Nombre; typeCastRecord.matricula = foundRecord.matricula; typeCastRecord.campus = foundRecord.campus; typeCastRecord.queja = foundRecord.queja1; typeCastRecord.Fecha = foundRecord.fecha; typeCastRecord.Estatus = "Activo"; db.Equipoes.Add(typeCastRecord); db.quejas.Remove(foundRecord); db.SaveChanges(); } return(Redirect("/Complain/")); }
// GET: Complain public ActionResult Index() { List <ComplainViewModel> lst; using (examenEntities db = new examenEntities()) { lst = (from d in db.quejas select new ComplainViewModel { Id = d.Id, Nombre = d.Nombre, Matricula = d.matricula, Campus = (Campus)d.campus, Queja = d.queja1, Fecha = d.fecha }).ToList(); } return(View(lst)); }
// GET: Decanato public ActionResult Index() { List <DecanatoViewModel> lst; using (examenEntities db = new examenEntities()) { lst = (from d in db.Decanatoes select new DecanatoViewModel { Id = d.Id, Nombre = d.Nombre, Matricula = d.matricula, Campus = (Campus)d.campus, Queja = d.queja, Fecha = d.Fecha, Estatus = d.Estatus }).ToList(); } return(View(lst)); }