예제 #1
0
        async void OnAddCustomerClicked()
        {
            if (Name == null || Password == null || Age == null)
            {
                System.Diagnostics.Debug.WriteLine("name, pass or age not set");
                await Application.Current.MainPage.DisplayAlert("Missing Field", "Please Enter all Fields", "Ok");
            }
            else
            {
                customer.Name     = Name;
                customer.Password = Password;
                try
                {
                    customer.Age = Convert.ToInt32(Age);
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                }
                var mongoService = new MongoService();
                await mongoService.CreateCustomer(customer);

                await Application.Current.MainPage.Navigation.PopAsync();
            }
        }