Example #1
0
        /// <summary>
        /// Unsubscribes by the provided in the query string subscriber id and issue id.
        /// </summary>
        /// <param name="newslettersManager">The newsletters manager.</param>
        /// <param name="subscriber">The subscriber.</param>
        /// <param name="mailingListId">The mailing list id.</param>
        /// <param name="issue">The issue.</param>
        private void Unsubscribe(NewslettersManager newslettersManager, Subscriber subscriber, Guid mailingListId, Campaign issue)
        {
            this.Message = this.GetUnsubscribeSuccessfulMessage(subscriber, issue);

            var isUnsubscribed = newslettersManager.Unsubscribe(subscriber, mailingListId, issue);

            if (isUnsubscribed)
            {
                newslettersManager.SaveChanges();
            }
        }
        /// <summary>
        /// Unsubscribes by the provided in the query string subscriber id and issue id.
        /// </summary>
        /// <param name="newslettersManager">The newsletters manager.</param>
        /// <param name="subscriber">The subscriber.</param>
        /// <param name="mailingListId">The mailing list id.</param>
        /// <param name="issue">The issue.</param>
        private void Unsubscribe(NewslettersManager newslettersManager, Subscriber subscriber, Guid mailingListId, Campaign issue)
        {
            MailingList list = null;

            if (issue == null)
            {
                list = newslettersManager.GetMailingLists().FirstOrDefault(m => m.Id == mailingListId);
            }
            this.Message = this.GetUnsubscribeSuccessfulMessage(subscriber, issue, list);

            var isUnsubscribed = newslettersManager.Unsubscribe(subscriber, mailingListId, issue);

            if (isUnsubscribed)
            {
                newslettersManager.SaveChanges();
            }
        }
        /// <summary>
        /// Unsubscribes by the provided in the query string subscriber id and issue id.
        /// </summary>
        /// <param name="newslettersManager">The newsletters manager.</param>
        /// <param name="subscriber">The subscriber.</param>
        /// <param name="mailingListId">The mailing list id.</param>
        /// <param name="issue">The issue.</param>
        private void Unsubscribe(NewslettersManager newslettersManager, Subscriber subscriber, Guid mailingListId, Campaign issue)
        {
            this.Message = this.GetUnsubscribeSuccessfulMessage(subscriber, issue);

            var isUnsubscribed = newslettersManager.Unsubscribe(subscriber, mailingListId, issue);
            if (isUnsubscribed)
            {
                newslettersManager.SaveChanges();
            }
        }