public void ActualizarClienteTest() { var mapperConfig = new MapperConfiguration(mc => { mc.AddProfile(new MappingProfile()); }); IMapper mapper = new Mapper(mapperConfig); var _clientedal = new ClienteDAL(_context, mapper); var clienteEditado = new ClienteDTO { IdCliente = 1, Nombre = "Roberto", Identificacion = "123456", TipoIdentificacion = 2, Activo = false, Eliminado = true }; _clientedal.EditarCliente(clienteEditado); var cliente = _context.Clientes .AsNoTracking() .FirstOrDefault(d => d.IdCliente == clienteEditado.IdCliente); Assert.AreEqual(clienteEditado.Nombre, cliente.Nombre); }
private void mtEditar_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()) && !String.IsNullOrEmpty(txtID.Text.Trim()) ) { if (!String.IsNullOrEmpty(txtID.Text)) { _cliente = _clienteDAL.ObtenerCliente(Convert.ToInt32(txtID.Text)); if (_cliente.ClienteID == Convert.ToInt32(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.EditarCliente(_cliente); CargaDatos(); LimpiarCajasDeTextos(); MetroFramework.MetroMessageBox.Show(this, "Edicion de dato exitosamente", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MetroFramework.MetroMessageBox.Show(this, "Por favor seleccionar un usuario con identificador", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } 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); } }
//Modificar dados de Usuários cadastrados public void EditarCliente(Cliente cliente) { clienteDAL.EditarCliente(cliente); }