/// <summary> /// Method used to unsubscribe a person from the MailChimp List (and Arena newsletter). /// </summary> /// <param name="person">person to subscribe</param> /// <param name="listID">MailChimp list ID</param> /// <param name="newsletterID">Arena's newsletter ID</param> private void Unsubscribe(Person person, string listID, int newsletterID) { api.listUnsubscribe(listID, person.Emails.FirstActive); NewsletterSubscription subscription = FetchOrCreateNewsletterSubscription(person, newsletterID); subscription.Status = false; subscription.Save(CurrentUser.Identity.Name); }
/// <summary> /// Method used to subscribe a person to the MailChimp List (and Arena newsletter). /// </summary> /// <param name="person">person to subscribe</param> /// <param name="listID">MailChimp list ID</param> /// <param name="newsletterID">Arena's newsletter ID</param> private void Subscribe(Person person, string listID, int newsletterID, ListItemCollection listItemCollection) { MCMergeVar[] merges = new MCMergeVar[5]; BuildMergeVars(person, merges, listItemCollection); if (api.listSubscribe(listID, person.Emails.FirstActive, merges)) { // Track the subscription locally too NewsletterSubscription subscription = FetchOrCreateNewsletterSubscription(person, newsletterID); subscription.Status = true; subscription.Save(CurrentUser.Identity.Name); } else { AddMsg("An error prevented the person from being subscribed to the list."); } }