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)); }
public IActionResult PartialCookieConsent() { var ViewModel = new CookieConsentVM(); var cookie = CookieServices.Read("Consent"); if (cookie.IsEmpty()) { ViewModel.showBanner = true; } return(View(ViewModel)); }