public Customer4A(Guid customerId, CustomerName name, Dob dateOfBirth, IdDocument idDocument, IEnumerable <Address4A> addresses, IAddressRepository4A3 addressRepository) : this(customerId, name, dateOfBirth, idDocument, addresses) { _addressRepository = addressRepository; }
public async Task <Customer4A> Get(Guid customerId, IAddressRepository4A3 addressRepository) { using (var conn = new SqlConnection()) { var customerData = await conn.QuerySingleOrDefaultAsync <CustomerData4A>( "SELECT * FROM Customers WHERE CustomerId = @customerId", new { customerId }); var addressesData = await conn.QueryAsync <AddressData4A>( "SELECT * FROM Addresses WHERE Customer", new { customerId }); var nameResult = CustomerName.Create(customerData.Title, customerData.FirstName, customerData.LastName); var dobResult = Dob.Create(customerData.DateOfBirth); var idDocumentResult = IdDocument.Create(customerData.IdDocumentType, customerData.IdDocumentNumber); var addresses = addressesData.Select(a => Address4A.Create(a.AddressId, a.HouseNoOrName, a.Street, a.City, a.County, a.PostCode, a.CurrentAddress).Value); return(new Customer4A(customerData.CustomerId, nameResult.Value, dobResult.Value, idDocumentResult.Value, addresses, addressRepository)); } }
public ChangeCurrentAddressCommand4A1Handler(ICustomerRepository4A1 customerRepository, IAddressRepository4A3 addressRepository) { _customerRepository = customerRepository; }