public ActionResult Actualizar(Persona modelo) { using (pruebamvcContext context = new pruebamvcContext()) { context.Entry(modelo).State = Microsoft.EntityFrameworkCore.EntityState.Modified; context.SaveChanges(); ViewBag.message = "Registro modificado correctamente."; } return(View("Modificar", modelo)); }
public ActionResult Eliminar(int id = 0) { IEnumerable <Persona> retorno = new List <Persona>(); using (pruebamvcContext context = new pruebamvcContext()) { context.Entry(new Persona() { Id = id }).State = Microsoft.EntityFrameworkCore.EntityState.Deleted; context.SaveChanges(); ViewBag.message = "Registro eliminado correctamente."; retorno = (from d in context.Personas select d).ToList(); } return(View("Index", retorno)); }