Пример #1
0
        async Task <bool> CreateUser()
        {
            var user = new User
            {
                Email       = Email,
                FirstName   = FirstName,
                LastName    = LastName,
                PhoneNumber = Phone,
                Password    = Password,
                Status      = new UserStatus {
                    ActiveStatus = Status.Active, LastUpdated = DateTime.UtcNow
                }
            };

            UserResponse response = await Acc.RegisterAsync(user, null);

            if (response.success)
            {
                if (await Acc.LoginAsync(Email, Password))
                {
                    App.ThisUser = user;
                    return(true);
                }
                else
                {
                    await App.UserDialogService.AlertAsync("Can't login with user " + Email, "Error", "OK");
                }
            }
            else
            {
                await App.UserDialogService.AlertAsync(response.errors != null?response.errors.First() : "Not sure what happened there, please try again", "Oops!", "Ok");
            }


            return(false);
        }