Exemplo n.º 1
0
        private void OnContactEdit(object sender, EventArgs e)
        {
            //open contact form with loaded data
            var form = new ContactForm();

            form.Text = "Edit Contact";

            var contact = GetSelectedContact();

            if (contact == null)
            {
                return;
            }

            form.Contact = contact;

            while (true)
            {
                if (form.ShowDialog(this) != DialogResult.OK)
                {
                    return;
                }
                try
                {
                    _contacts.Update(contact.Id, form.Contact);
                    break;
                } catch (Exception ex)
                {
                    DisplayError(ex);
                };
            }
            ;

            BindList();
        }