예제 #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));
        }
예제 #2
0
        public IActionResult PartialCookieConsent()
        {
            var ViewModel = new CookieConsentVM();

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

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

            return(View(ViewModel));
        }