Exemple #1
0
        public MediatorResponse Unsubscribe(Guid?candidateId, Guid subscriberId, SubscriptionTypes subscriptionType)
        {
            var unsubscribed = _candidateServiceProvider.Unsubscribe(subscriberId, subscriptionType);

            if (!unsubscribed)
            {
                return(GetMediatorResponse(UnsubscribeMediatorCodes.Unsubscribe.Error, UnsubscribePageMessages.FailedToUnsubscribe, UserMessageLevel.Error));
            }

            var mediatorCode = UnsubscribeMediatorCodes.Unsubscribe.UnsubscribedNotSignedIn;

            if (!candidateId.HasValue)
            {
                return(GetMediatorResponse(mediatorCode, UnsubscribePageMessages.Unsubscribed, UserMessageLevel.Success));
            }

            switch (subscriptionType)
            {
            case SubscriptionTypes.SavedSearchAlertsViaEmail:
                mediatorCode = UnsubscribeMediatorCodes.Unsubscribe.UnsubscribedShowSavedSearchesSettings;
                break;

            default:
                mediatorCode = UnsubscribeMediatorCodes.Unsubscribe.UnsubscribedShowAccountSettings;
                break;
            }

            return(GetMediatorResponse(mediatorCode, UnsubscribePageMessages.Unsubscribed, UserMessageLevel.Success));
        }