public void EditClient(ClientDto clientDto) { using (var transaction = new TransactionScope()) { var client = clientDto.CreateEntity(); _clientRepository.EditClient(client); client.Address.ClientId = client.ClientId; _addressRepository.EditAddress(client.Address); transaction.Complete(); } }
public int CreateClient(ClientDto clientDto) { var client = clientDto.CreateEntity(); _googleMapsRepository.GetLatirudeAndLogitudeOfAnAddress(client.Address); using (var transaction = new TransactionScope()) { int clientId = _clientRepository.CreateClient(client); client.Address.ClientId = clientId; _addressRepository.CreateAddres(client.Address); transaction.Complete(); return(clientId); } }