public void Add(Provider provider) { _repositoryProvider.Add(provider); if (provider.Addresses.Any()) { foreach (var address in provider.Addresses) { address.SetProvider(provider.Id); _serviceAddress.Add(address); } } if (provider.Addresses.Any()) { foreach (var contact in provider.Contacts) { contact.SetProvider(provider.Id); _serviceContact.Add(contact); } } }
public void Add(Client client) { _repositoryClient.Add(client); if (client.Addresses.Any()) { foreach (var address in client.Addresses) { address.SetClient(client.Id); _serviceAddress.Add(address); } } if (client.Contacts.Any()) { foreach (var contact in client.Contacts) { contact.SetClient(client.Id); _serviceContact.Add(contact); } } }