public RegisterPageViewModel() { RegisterData = new RegisterModel(); SaveRegisterDataCommand = new Command(async() => { if (!UserValidations.IsnotEmpty(RegisterData.UserName)) { Result = "El nombre de usuario es requerido"; } else if (!UserValidations.IsnotEmpty(RegisterData.Email)) { Result = "El Email de usuario es requerido"; } else if (!UserValidations.IsnotEmpty(RegisterData.Password) || !UserValidations.IsnotEmpty(RegisterData.ConfirmPassword)) { Result = "Las contraseña es requerida "; } else if (!UserValidations.IsEqual(RegisterData.Password, RegisterData.ConfirmPassword)) { Result = "Las contraseñas no coinciden"; } else { await Application.Current.MainPage.Navigation.PushModalAsync(new HomePage()); } }); }
async Task RegisterValidations(RegisterModel register) { if (!UserValidations.IsnotEmpty(register.UserName)) { Result = ErrorCodes.UserNameRequired; } else if (!UserValidations.IsnotEmpty(register.Password)) { Result = ErrorCodes.PasswordRequired; } else if (!UserValidations.IsEqual(register.Password, ConfirmPassword)) { Result = ErrorCodes.PassNoMatch; } else if (!UserValidations.IsnotEmpty(register.Email)) { Result = ErrorCodes.UserEmailRequired; } else if (!UserValidations.NumberIsNotEmpty(register.Number)) { Result = ErrorCodes.TelNumberRequired; } else { await ToHomePage(); } }