private void UpdateDeliveryAddressFrom( DeliveryAddressView deliveryAddressSource, DeliveryAddress deliveryAddressToUpdate) { deliveryAddressToUpdate.Name = deliveryAddressSource.Name; deliveryAddressToUpdate.AddressLine1 = deliveryAddressSource.AddressLine1; deliveryAddressToUpdate.AddressLine2 = deliveryAddressSource.AddressLine2; deliveryAddressToUpdate.City = deliveryAddressSource.City; deliveryAddressToUpdate.State = deliveryAddressSource.State; deliveryAddressToUpdate.Country = deliveryAddressSource.Country; deliveryAddressToUpdate.ZipCode = deliveryAddressSource.ZipCode; }
public DeliveryAddressAddResponse AddDeliveryAddress( DeliveryAddressAddRequest request) { DeliveryAddressAddResponse response = new DeliveryAddressAddResponse(); Customer customer = _customerRepository .FindBy(request.CustomerIdentityToken); DeliveryAddress deliveryAddress = new DeliveryAddress(); deliveryAddress.Customer = customer; UpdateDeliveryAddressFrom(request.Address, deliveryAddress); customer.AddAddress(deliveryAddress); _customerRepository.Save(customer); _uow.Commit(); response.DeliveryAddress = deliveryAddress .ConvertToDeliveryAddressView(); return response; }