private static AddressData GetAddressDataObject(Nop280_Address address, Dictionary <int, Nop280_StateProvince> stateProvinces,
                                                        Dictionary <int, Nop280_Country> countries)
        {
            var state =
                stateProvinces.ContainsKey(address.StateProvinceId.GetValueOrDefault())
                    ? stateProvinces[address.StateProvinceId.GetValueOrDefault()]
                    : null;
            var country = countries.ContainsKey(address.CountryId.GetValueOrDefault())
                ? countries[address.CountryId.GetValueOrDefault()]
                : null;

            return(new AddressData
            {
                Id = address.Id,
                FirstName = address.FirstName,
                LastName = address.LastName,
                Address1 = address.Address1,
                Address2 = address.Address2,
                Company = address.Company,
                City = address.City,
                StateProvince = state != null ? state.Name : string.Empty,
                PostalCode = address.ZipPostalCode,
                PhoneNumber = address.PhoneNumber,
                CountryCode = country != null ? country.TwoLetterIsoCode : string.Empty,
                Email = address.Email
            });
        }
Exemple #2
0
 private static AddressData GetAddressDataObject(Nop280_Address address)
 {
     return(new AddressData
     {
         Id = address.Id,
         FirstName = address.FirstName,
         LastName = address.LastName,
         Address1 = address.Address1,
         Address2 = address.Address2,
         Company = address.Company,
         City = address.City,
         StateProvince = address.Nop280_StateProvince != null ? address.Nop280_StateProvince.Name : string.Empty,
         PostalCode = address.ZipPostalCode,
         PhoneNumber = address.PhoneNumber,
         Country = address.CountryId,
         Email = address.Email
     });
 }