private AddressViewModel MapAddress(AddressPart addressPart, CustomerPart customer) { var addressViewModel = new AddressViewModel(); if (addressPart != null) { addressViewModel.Name = addressPart.Name; addressViewModel.Address = addressPart.Address; addressViewModel.State = addressPart.State; addressViewModel.Postcode = addressPart.Postcode; addressViewModel.City = addressPart.City; addressViewModel.CountryCode = addressPart.CountryCode; } addressViewModel.CountryCodes = CountryCode.SelectList; return addressViewModel; }
private AddressPart MapAddress(AddressViewModel source, string addressType, CustomerPart customerPart) { var addressPart = _customerService.GetAddress(customerPart.Id, addressType) ?? _customerService.CreateAddress(customerPart.Id, addressType); addressPart.Name = source.Name.TrimSafe(); addressPart.Address = source.Address.TrimSafe(); addressPart.State = source.State.TrimSafe(); addressPart.Postcode = source.Postcode.TrimSafe(); addressPart.City = source.City.TrimSafe(); addressPart.CountryCode = source.CountryCode.TrimSafe(); return addressPart; }
private AddressPart MapAddress(AddressViewModel source, string addressType, CustomerPart customerPart) { // Allow for many different Shipping Addresses: one for each order AddressPart addressPart; if (addressType == "InvoiceAddress") { addressPart = _customerService.GetInvoiceAddress(customerPart.Id); if (addressPart == null) addressPart = _customerService.CreateAddress(customerPart.Id, addressType, 0); } else { addressPart = _customerService.CreateAddress(customerPart.Id, addressType, 0); } addressPart.Name = source.Name.TrimSafe(); addressPart.Address = source.Address.TrimSafe(); addressPart.State = source.State.TrimSafe(); addressPart.Postcode = source.Postcode.TrimSafe(); addressPart.City = source.City.TrimSafe(); addressPart.CountryCode = source.CountryCode.TrimSafe(); return addressPart; }