Пример #1
0
        public async void Register(RegisterUser user)
        {
            var        Url        = "http://shopbasket.azurewebsites.net/api/register";
            HttpClient httpClient = new HttpClient();

            //bool IsLoading = true;



            var jsonObject = JsonConvert.SerializeObject(user);
            var content    = new StringContent(jsonObject, Encoding.UTF8, "application/json");

            var response = await httpClient.PostAsync(Url, content);

            if (response.IsSuccessStatusCode)
            {
                var content2 = await response.Content.ReadAsStringAsync();


                if (content2 == "Register successfully")
                {
                    RegisterPage registerPage = new RegisterPage();

                    await registerPage.DisplayAlert("Register", "Register Successfull!!", "OK");
                }
            }
            else
            {
                Debug.WriteLine("An error occured while loading data");
            }

            //IsLoading = false;
        }
Пример #2
0
        private async void Registration()
        {
            if (firstname == null || surname == null || mail == null || password == null)
            {
                await registerPage.DisplayAlert("Fehler", "Es wurden nicht alle Eigenschaften ausgefüllt.", "OK");

                return;
            }
            userService.Save(new User
            {
                FirstName = this.firstname,
                Surname   = this.surname,
                Mail      = this.mail,
                Password  = this.password
            });

            await registerPage.DisplayAlert("Erfolgreich", "Sie können sich nun anmelden.", "OK");

            await registerPage.Navigation.PushAsync(new AccountManagementPage());
        }
Пример #3
0
        public async void Execute(object parameter)
        {
            var success = await RegisterPage.RegisterViewModel.Register();

            if (success)
            {
                await App.Navigation.PopAsync(false);

                await App.Navigation.PushAsync(App.Home);

                await RegisterPage.DisplayAlert("Success", "Welcome to Carry-in!", "Continue");
            }
            else
            {
                await RegisterPage.DisplayAlert("Error", "To be determined text.", "Try Again");
            }
        }