Exemplo n.º 1
0
        private async void OnAdd(object sender, System.EventArgs e)
        {
            var contact = new ContactBookRecord();
            await _connection.InsertAsync(contact);

            _contacts.Add(contact);
        }
Exemplo n.º 2
0
        private async void MenuItemDelete_OnClicked(object sender, EventArgs e)
        {
            ContactBookRecord contact = ((MenuItem)sender).CommandParameter as ContactBookRecord;
            bool deleteRecord         = await DisplayAlert("Delete contact?", $"Do you really want to delete {contact.FullName}?",
                                                           "Yes", "No");

            if (deleteRecord)
            {
                _contacts.Remove(contact);
            }
        }
Exemplo n.º 3
0
        public ContactBookExerciseEditPage(ContactBookRecord contact)
        {
            if (contact is null)
            {
                throw new ArgumentNullException(nameof(contact));
            }

            InitializeComponent();
            var editContact = new ContactBookRecord()
            {
                ID        = contact.ID,
                FirstName = contact.FirstName,
                LastName  = contact.LastName,
                Phone     = contact.Phone,
                Email     = contact.Email,
                IsBlocked = contact.IsBlocked
            };

            BindingContext = editContact;
        }