public RootEntity() { this.Contacts = new AdvisableCollection<Contact>(); this.countries = new AdvisableCollection<Country>(); foreach (string country in Populate.GetCountries()) { this.countries.Add(new Country(country)); } Country russia = this.countries.Single(c => c.Name == "Russia"); foreach (string contactName in Populate.GetContacts()) { string[] names = contactName.Split(' '); Contact contact = new Contact(names[0], names[1]); Address address = new Address { AddressLine1 = "23, Ilyinka Street", Town = "Moscow", Zip = "103132", Country = russia }; contact.Addresses.Add(address); contact.PrincipalAddress = address; this.Contacts.Add(contact); } RecordingServices.DefaultRecorder.Clear(); }
private void AddAddressButton_Click(object sender, RoutedEventArgs e) { Address address = new Address(); this.contact.Addresses.Add(address); this.contact.PrincipalAddress = address; }