// Checks whether the current user belongs to the specified persona // Called when the visibility condition is evaluated by the server public override bool IsVisible() { ContactInfo currentContact = ContactManagementContext.GetCurrentContact(); string currentPersonaName = currentContact?.GetPersona()?.PersonaName; return(String.Equals(currentPersonaName, RequiredPersona, StringComparison.InvariantCultureIgnoreCase)); }
public CurrentContactViewModel(ContactInfo currentContact) { PersonaInfo contactPersona = currentContact.GetPersona(); if (contactPersona != null) { ContactPersonaName = contactPersona.PersonaName; ContactPersonaDisplayName = contactPersona.PersonaDisplayName; } }
private void DummyPersonalizationMethod() { //DocSection:PersonaPersonalization // Gets the current contact ContactInfo currentContact = ContactManagementContext.GetCurrentContact(); // Gets the code name of the current contact's persona string currentPersonaName = currentContact?.GetPersona()?.PersonaName; // Checks whether the current contact is assigned to the "EarlyAdopter" persona if (String.Equals(currentPersonaName, "EarlyAdopter", StringComparison.InvariantCultureIgnoreCase)) { // Serve personalized content for the "EarlyAdopter" persona } //EndDocSection:PersonaPersonalization }
private void DummyPersonalizationMethod() { //DocSection:PersonaPersonalization // Gets the current contact IContactTrackingService contactService = new ContactTrackingService(); ContactInfo currentContact = contactService.GetCurrentContactAsync(User.Identity.Name).Result; // Gets the code name of the current contact's persona string currentPersonaName = currentContact.GetPersona()?.PersonaName; // Checks whether the current contact is assigned to the "EarlyAdopter" persona if (String.Equals(currentPersonaName, "EarlyAdopter", StringComparison.InvariantCultureIgnoreCase)) { // Serve personalized content for the "EarlyAdopter" persona } //EndDocSection:PersonaPersonalization }