Example #1
0
        /// <summary>
        /// Basic action that displays the registration form.
        /// </summary>
        public ActionResult Register()
        {
            var model = new RegisterWithConsentViewModel
            {
                // Adds the consent text to the registration model
                ConsentShortText = consent.GetConsentText("en-US").ShortText,
                ConsentIsAgreed  = false
            };

            return(View("RegisterWithConsent", model));
        }
        /// <summary>
        /// Basic action that displays the feedback form.
        /// </summary>
        public ActionResult Fill()
        {
            var model = new FeedbackFormMessageConsentModel
            {
                // Adds the consent text to the form model
                ConsentShortText = consent.GetConsentText("en-US").ShortText,
                ConsentIsAgreed  = false
            };

            return(View("FormFillConsent", model));
        }
Example #3
0
        //EndDocSection:Constructor

        //DocSection:DisplayConsent
        public ActionResult DisplayConsent()
        {
            // Gets the related tracking consent
            // Fill in the code name of the appropriate consent object in Kentico
            ConsentInfo consent = ConsentInfoProvider.GetConsentInfo("SampleTrackingConsent");

            // Gets the current contact
            ContactInfo currentContact = ContactManagementContext.GetCurrentContact();

            // Sets the default cookie level for contacts who have revoked the tracking consent
            // Required for scenarios where one contact uses multiple browsers
            if ((currentContact != null) && !consentAgreementService.IsAgreed(currentContact, consent))
            {
                var defaultCookieLevel = currentCookieLevelProvider.GetDefaultCookieLevel();
                currentCookieLevelProvider.SetCurrentCookieLevel(defaultCookieLevel);
            }

            var consentModel = new TrackingConsentViewModel
            {
                // Adds the consent's short text to the model
                ShortText = consent.GetConsentText("en-US").ShortText,

                // Checks whether the current contact has given an agreement for the tracking consent
                IsAgreed = (currentContact != null) && consentAgreementService.IsAgreed(currentContact, consent)
            };

            return(View("Consent", consentModel));
        }