Esempio n. 1
0
        public IViewComponentResult Invoke()
        {
            var consentFeature = context.Features.Get <ITrackingConsentFeature>();
            var vm             = new CookieConsentVM
            {
                ShowBanner   = !consentFeature?.CanTrack ?? false,
                CookieString = consentFeature?.CreateConsentCookie(),
            };

            return(View("CookieConsent.cshtml", vm));
        }
Esempio n. 2
0
        public IActionResult PartialCookieConsent()
        {
            var ViewModel = new CookieConsentVM();

            var cookie = CookieServices.Read("Consent");

            if (cookie.IsEmpty())
            {
                ViewModel.showBanner = true;
            }

            return(View(ViewModel));
        }