/UpdateAddressesFacet.cs Secret
Last active
January 20, 2016 07:38
Star
You must be signed in to star a gist
How to update the Addresses facet in Sitecore xDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IContactAddresses contactAddresses = contact.GetFacet<IContactAddresses>("Addresses"); | |
if (string.IsNullOrEmpty(contactAddresses.Preferred)) | |
contactAddresses.Preferred = "Shipping Address"; | |
if (!contactAddresses.Entries.Contains("Shipping Address")) | |
contactAddresses.Entries.Create("Shipping Address"); | |
contactAddresses.Entries["Shipping Address"].StreetLine1 = orderFormModel.AddressLine1; | |
contactAddresses.Entries["Shipping Address"].StreetLine2 = orderFormModel.AddressLine2; | |
contactAddresses.Entries["Shipping Address"].City = orderFormModel.CityTown; | |
contactAddresses.Entries["Shipping Address"].StateProvince = orderFormModel.State.Value; | |
contactAddresses.Entries["Shipping Address"].Country = orderFormModel.Country.Value; | |
contactAddresses.Entries["Shipping Address"].PostalCode = OrderFormModel.PostalCode; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment