Esempio n. 1
0
        private void CreateButton_Click(object sender, EventArgs e)
        {
            var id = Phonebook.Contacts.OrderByDescending(c => c.Id).First().Id;

            var contact = new Contact(++id, nameTextbox.Text, emailTextbox.Text, dobPicker.Value.Date, numberTextbox.Text);

            Phonebook.AddContactToList(contact);
            var reader = new JsonDataAccess();

            reader.SaveData();
            MessageBox.Show("Contact created.");
            Close();
        }