Exemple #1
0
        public ActionResult Accept()
        {
            // Gets the related tracking consent
            ConsentInfo consent = ConsentInfoProvider.GetConsentInfo("SampleTrackingConsent");

            // Sets the visitor's cookie level to 'All' (enables contact tracking)
            currentCookieLevelProvider.SetCurrentCookieLevel(CookieLevel.All);

            // Gets the current contact and creates a consent agreement
            ContactInfo currentContact = ContactManagementContext.GetCurrentContact();

            consentAgreementService.Agree(currentContact, consent);

            return(RedirectToAction("DisplayConsent"));
        }
Exemple #2
0
        public ActionResult Agree()
        {
            var resultStatus = HttpStatusCode.BadRequest;

            var consent = ConsentInfoProvider.GetConsentInfo(TrackingConsentGenerator.CONSENT_NAME);

            if (consent != null)
            {
                mCookieLevelProvider.SetCurrentCookieLevel(CookieLevel.All);
                mConsentAgreementService.Agree(ContactManagementContext.CurrentContact, consent);

                resultStatus = HttpStatusCode.OK;
            }

            // Redirect is handled on client by javascript
            return(new HttpStatusCodeResult(resultStatus));
        }
Exemple #3
0
        public ActionResult Agree(string returnUrl)
        {
            var consent = consentInfoProvider.Get(TrackingConsentGenerator.CONSENT_NAME);

            if (consent != null)
            {
                cookieLevelProvider.SetCurrentCookieLevel(CookieLevel.All);

                var contact = ContactManagementContext.CurrentContact;
                if (contact != null)
                {
                    consentAgreementService.Agree(contact, consent);
                }

                return(Redirect(returnUrl));
            }

            return(new StatusCodeResult(StatusCodes.Status400BadRequest));
        }