private async void btnCrear_Click(object sender, EventArgs e) { var nombre = txtNombre.Text; var apellido = txtApellido.Text; var username = txtUsername.Text; if (string.IsNullOrEmpty(nombre)) { Mensajes.EmptyFields(); txtNombre.Focus(); } else if (string.IsNullOrEmpty(apellido)) { Mensajes.EmptyFields(); txtApellido.Focus(); } else if (string.IsNullOrEmpty(username) || string.IsNullOrWhiteSpace(username)) { Mensajes.EmptyFields(); txtUsername.Focus(); } else { _usuario.nombre = nombre; _usuario.apellido = apellido; _usuario.username = username; _usuario.pass = Encriptar.encriptarPassword(nombre + apellido + "123"); var rs = await _controller.AddUsuarioAsync(_usuario); if (rs > 0) { Mensajes.AgregadoConExito(); limpiar(); } else { Mensajes.EliminadoConExito(); } } }