public int CrearCliente(Cliente cliente) { try { return(clie.CrearCliente(cliente)); } catch (Exception err) { throw err; } }
//boton de guardar private void mtGuardar_Click(object sender, EventArgs e) { try { if ( !String.IsNullOrEmpty(txtNombre.Text.Trim()) && !String.IsNullOrEmpty(txtApellido.Text.Trim()) && !String.IsNullOrEmpty(txtDireccion.Text.Trim()) && !String.IsNullOrEmpty(txtDepartamento.Text.Trim()) && !String.IsNullOrEmpty(txtMunicipio.Text.Trim()) && !String.IsNullOrEmpty(txtDUI.Text.Trim()) ) { if (String.IsNullOrEmpty(txtID.Text)) { _cliente.Nombre = txtNombre.Text; _cliente.Apellido = txtApellido.Text; _cliente.Direccion = txtDireccion.Text; _cliente.Departamento = txtDepartamento.Text; _cliente.Municipio = txtMunicipio.Text; _cliente.DUI = txtDUI.Text; _clienteDAL.CrearCliente(_cliente); CargaDatos(); LimpiarCajasDeTextos(); MetroFramework.MetroMessageBox.Show(this, "Registro de dato exitosamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MetroFramework.MetroMessageBox.Show(this, "Por favor usar el boton Refrescar", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MetroFramework.MetroMessageBox.Show(this, "Completar todos los campos", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } catch (Exception ex) { MetroFramework.MetroMessageBox.Show(this, ex.Message, "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public async Task <Respuesta <IClienteDTO> > CrearCliente(IClienteDTO cliente) { return(await clienteDAL.CrearCliente(cliente)); }