public ActionResult Edit(FormCollection collecion) { BeCliente objcliente = new BeCliente(); objcliente.IdCliente = int.Parse(collecion["IdCliente"]); objcliente.Nombres = collecion["Nombres"].Trim(); objcliente.ApellidoPaterno = collecion["ApellidoPaterno"].Trim(); objcliente.ApellidoMaterno = collecion["ApellidoMaterno"].Trim(); objcliente.Email = collecion["Email"].Trim(); objcliente.NumeroMovil = collecion["NumeroMovil"].Trim(); CrudClientes.Updateclientes(objcliente); return(RedirectToAction("Index")); }
private void btnGuardar_Click(object sender, EventArgs e) { try { DialogResult dr = MessageBox.Show("¿Esta seguro de guardar al cliente " + textBoxNom.Text + " " + textBoxApe.Text + "?", "INFO", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk); if (dr.Equals(DialogResult.Yes)) { if (textBoxNom.Text != "" && textBoxApe.Text != "" && textBoxTel.Text != "" && textBoxCel.Text != "" && textBoxEmail.Text != "" && (radioBno.Checked != false || radioBsi.Checked != false)) { if (!id.Equals(Guid.Empty)) { Clientes client = new Clientes { idCliente = id, nombre = textBoxNom.Text, apellidos = textBoxApe.Text, telefono = textBoxTel.Text, celular = textBoxCel.Text, correo = textBoxEmail.Text, activo = activo }; CrudClientes.Modificar(client); clearInterface(); cargarTabla(); } else { if (CrudClientes.VerificarClientes(textBoxTel.Text).Equals(false)) { Clientes newClient = new Clientes { idCliente = Guid.NewGuid(), nombre = textBoxNom.Text, apellidos = textBoxApe.Text, telefono = textBoxTel.Text, celular = textBoxCel.Text, correo = textBoxEmail.Text, activo = activo }; CrudClientes.Alta(newClient); clearInterface(); cargarTabla(); } else { MessageBox.Show("El cliente " + textBoxNom.Text + " " + textBoxApe.Text + "ya existe si quiere modificar solo seleccionelo en las tablas de abajo", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } else { MessageBox.Show("Ingrese los campos faltantes", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void cargarTabla() { dgvClientes.AutoGenerateColumns = false; dgvClientes.DataSource = CrudClientes.Consulta(); }
public ActionResult Edit(int id) { return(View(CrudClientes.Editclientes(id))); }
// // GET: /Clientes/ public ActionResult Index() { return(View(CrudClientes.Listclientes())); }
public ActionResult Delete(int id) { CrudClientes.DeleteClientes(id); return(RedirectToAction("Index")); }