public ActionResult Delete(int id) { try { cliente cliente = new cliente(); ladoCliente lc = new ladoCliente(); cliente = lc.listarclientexuno(id); int id2 = (int)cliente.id_cliente; string nombre = cliente.nombre.ToString(); string direccion = cliente.direccion.ToString(); int id_distrito = (int)cliente.id_distrito; string estado = cliente.estado.ToString(); estado = "0"; cliente cli = new cliente(); cli.id_cliente = id2; cli.nombre = nombre; cli.direccion = direccion; cli.id_distrito = id_distrito; cli.estado = estado; lc.modificar(cli); return(RedirectToAction("Index")); } catch { return(View()); } }
public ActionResult Edit(cliente cliente) { try { // TODO: Add update logic here int id = (int)cliente.id_cliente; string nombre = cliente.nombre.ToString(); string direccion = cliente.direccion.ToString(); int id_distrito = (int)cliente.id_distrito; string estado = "1"; cliente cli = new cliente(); cli.id_cliente = id; cli.nombre = nombre; cli.direccion = direccion; cli.id_distrito = id_distrito; cli.estado = estado; ladoCliente lc = new ladoCliente(); lc.modificar(cli); return(RedirectToAction("Index")); } catch { return(View()); } }