Consent manager

An instance of ConsentManager is available on TemplateBase which represents a razor template (classic or view model).

ConsentManager can be used like this in razor templates:

RAZOR
// Get all activities var activities = Consents.GetActivities(); // Get a specific activity var activity = Consents.GetActivity(activityId); /* Visitor consents */ // Get all consents by the current visitor. var visitorConsents = Consents.Visitor.GetConsents(); // Get the consent to an activity by the current visitor. var visitorConsent = Consents.Visitor.GetConsent(activityId); // Determine if the current visitor has given consent to an activity. var isVisitorConsentGiven = Consents.Visitor.IsConsentGiven(activityId); // Give consent to an activity. Consents.Visitor.GiveConsent(activityId); // Withdraw consent to an activity. Consents.Visitor.WithdrawConsent(activityId); /* User consents */ // Similar to visitor consents Consents.User.*** /* Email consents */ // Similar to visitor consents Consents.Email.***