Table of Contents

Class AddressViewModelExtensions

Namespace
Dynamicweb.Frontend
Assembly
Dynamicweb.dll
public static class AddressViewModelExtensions
Inheritance
AddressViewModelExtensions
Inherited Members

Methods

GetCountrySpecificStreetAddress(AddressViewModel)

Gets the country-specific street address format for the user. For country codes "US", "CA", "MX", "GB", "IE", "AU" it will return the house number before the address. Otherwise, it will return the house number after the address. If house number is provided, it will be prepended or appended to the address based on the country code. If the address is empty, it will return an empty string. If no house number is provided, it will return the address as is and expect the address field to contain both street name and house number in the correct order.

public static string GetCountrySpecificStreetAddress(this AddressViewModel model)

Parameters

model AddressViewModel

The user view model.

Returns

string

The formatted street address.

Examples

CountryCode = "US",
HouseNumber = "123",
Address = "Main Street"
Output: 
123 Main Street
CountryCode = "DK",
HouseNumber = "456",
Address = "Main Street"
Output: 
Main Street 456

GetCountrySpecificZipStateCity(AddressViewModel)

Gets the country-specific zip and city format including the state where applicable. For country codes "US", "CA", "MX", "GB", "IE", "AU" it will return the city, state, and zip code. Otherwise, it will return the zip code and city.

public static string GetCountrySpecificZipStateCity(this AddressViewModel model)

Parameters

model AddressViewModel

The user view model.

Returns

string

The formatted address.

Examples

CountryCode = "US",
State = "NY",
ZipCode = "10014",
City = "New York",
Output: 
New York, NY 10014
CountryCode = "DK",
State = "",
ZipCode = "2100",
City = "Copenhagen",
Output: 
2100 Copenhagen
To top