Exemplo n.º 1
0
        void Handle_Submit(object sender, ClickedEventArgs e)
        {
            if (String.IsNullOrWhiteSpace(fName.Text) || String.IsNullOrWhiteSpace(lName.Text))
            {
                DisplayAlert("Warning", "You must enter a Full Name", "Close");
            }
            else
            {
                temp = new Contact
                {
                    Id        = intialId,
                    FirstName = fName.Text,
                    LastName  = lName.Text,
                    Phone     = phone.Text,
                    Email     = email.Text,
                    Blocked   = isBlocked.IsToggled
                };

                if (intialId > _contacts.GetAllContacts().Last().Id)
                {
                    _contacts.AddContact(temp);
                }
                else
                {
                    _contacts.UpdateContact(temp);
                }

                Navigation.PopAsync();
            }
        }