Skip to content

Instantly share code, notes, and snippets.

@JRondeau16
Created June 27, 2018 17:27
Show Gist options
  • Save JRondeau16/d1d7c79a1b1d73cdd423480f727cae68 to your computer and use it in GitHub Desktop.
Save JRondeau16/d1d7c79a1b1d73cdd423480f727cae68 to your computer and use it in GitHub Desktop.
public ActionResult ContactUs()
{
var model = new ContactUsViewModel();
if ((Tracker.Current != null) && (Tracker.Current.Contact != null))
{
var contact = Tracker.Current.Contact;
var personal = contact.GetFacet<IContactPersonalInfo>("Personal");
var phoneFacet = contact.GetFacet<IContactPhoneNumbers>("Phone Numbers");
var addressFacet = contact.GetFacet<IContactAddresses>("Addresses");
var emailFacet = Tracker.Current.Contact.GetFacet<IContactEmailAddresses>("Emails");
model.Name = personal.FirstName + " " + personal.Surname;
if(emailFacet.Entries.Contains("SFMCEmail"))
model.Email = emailFacet?.Entries["SFMCEmail"]?.SmtpAddress;
if (phoneFacet.Entries.Contains("HomePhone"))
model.Phone = phoneFacet.Entries["HomePhone"]?.Number;
}
return View(model);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment