コード例 #1
0
        private async void UpdateCommandExecuted()
        {
            try
            {
                if (!string.IsNullOrWhiteSpace(Email) && Validator.ValidateEmail(Email))
                {
                    if (!string.IsNullOrWhiteSpace(User) && Validator.ValidateLegth(User))
                    {
                        if (!string.IsNullOrWhiteSpace(Password) && Validator.ValidatePassword(Password))
                        {
                            if (!string.IsNullOrWhiteSpace(SelectedPicker))
                            {
                                userModel.User     = User;
                                userModel.Status   = IsToggled;
                                userModel.Sex      = SelectedPicker;
                                userModel.Password = Password;
                                userModel.Email    = Email;
                                var result = await login.Update(userModel);

                                if (result)
                                {
                                    await snack.SnackSuccess("se actualizo correctamente");

                                    await PopupNavigation.PopAsync();

                                    MessagingCenter.Send <updateUserPageViewModel>(this, "send");
                                }
                                else
                                {
                                    await snack.SnackError("Ocurrio un error");
                                }
                            }
                            else
                            {
                                await snack.SnackError("Seleccione un genero");
                            }
                        }


                        else
                        {
                            await snack.SnackError("ingrese una contraseña valida");
                        }
                    }
                    else
                    {
                        await snack.SnackError("Ingrese un usuario valido");
                    }
                }
                else
                {
                    await snack.SnackError("Ingrese un email valido");
                }
            }
            catch (Exception ex)
            {
            }
        }