private void DummyContactMethod() { //DocSection:GetCurrentContact // Gets the current contact IContactTrackingService contactService = new ContactTrackingService(); ContactInfo currentContact = contactService.GetCurrentContactAsync(User.Identity.Name).Result; //EndDocSection:GetCurrentContact }
/// <summary> /// Mutate user list of Physical Contacts /// </summary> /// <param name="contacts">Realized contacts</param> /// <param name="service">people contact service</param> /// <returns>Synchronization tokens</returns> public async Task <IEnumerable <SynchronizationToken> > AddPhysicalContacts( IEnumerable <PhysicalContact> contacts, [Service] ContactTrackingService service) { var synchronizedTokens = await service.TrackContacts(contacts); return(synchronizedTokens); }
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 }
//DocSection:GetVaryByCustom public override string GetVaryByCustomString(HttpContext context, string arg) { // Defines caching requirements based on the on-line marketing data of the current contact if (arg == "contactdata") { // Gets the current contact ContactInfo currentContact = new ContactTrackingService().GetExistingContactAsync().Result; if (currentContact != null) { // Ensures separate caching for each combination of the following contact variables: contact groups, persona, gender // Note: This does NOT define separate caching for every contact return(String.Format("ContactData={0}|{1}|{2}", String.Join("|", currentContact.ContactGroups.Select(c => c.ContactGroupName).OrderBy(x => x)), currentContact.ContactPersonaID, currentContact.ContactGender)); } } return(base.GetVaryByCustomString(context, arg)); }
public Mutation(ContactTrackingService service) { _service = service ?? throw new ArgumentNullException(nameof(service)); }