public ActionResult Alta() { Models.ContextoDb ConRef = Models.ContextoDb.obtenerInstancia(); var cliList = ConRef.Clientes.ToList(); return(View()); }
public ActionResult Alta(Models.Cliente cli) { try { Models.ContextoDb ConRef = Models.ContextoDb.obtenerInstancia(); if (cli.Nombre != null || cli.Apellido != null) { if (ModelState.IsValid) { ConRef = Models.ContextoDb.obtenerInstancia(); ConRef.Clientes.Add(cli); ConRef.SaveChanges(); } } var cliList = ConRef.Clientes.ToList(); return(View("Listar", cliList)); } catch { return(View()); } }