private void btnRegistrar_Click(object sender, EventArgs e) { string token = Session.Token; var address = txtDireccion.Text; var city = txtCiudad.Text; var country = txtPais.Text; var email = txtEmail.Text; var fullName = txtNombreCompleto.Text; var idProfile = Convert.ToInt32(cmbPerfil.SelectedValue); var password = txtPassword.Text; var emailCheck = email_bien_escrito(email); if (emailCheck) { if (address != null && city != null && country != null && email != null && fullName != null && idProfile != 0 && password != null) { //si el usuario existe List <string> lst = new List <string>(); var findAllUsers = VirtualFairIntegration.GetFindAllUser(token); foreach (var item in findAllUsers.users) { if (item.email == email) { string text = "Usuario ya existe"; string title = "Información"; MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information); return; } } dynamic user = new System.Dynamic.ExpandoObject(); user.address = address; user.city = city; user.country = country; user.email = email; user.fullName = fullName; user.idProfile = idProfile; user.password = password; var createUser = VirtualFairIntegration.CreateUser(token, user); if (createUser.statusCode == 201) { string text = createUser.message; string title = "Información"; MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { string text = "Debe ingresar todos los campos requeridos"; string title = "Información"; MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { string text = "Email mal ingresado"; string title = "Información"; MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information); } }