Exemple #1
0
        //EndDocSection:Constructor

        //DocSection:Index
        /// <summary>
        /// Loads and displays consents for which visitors have given agreements.
        /// </summary>
        public ActionResult Index()
        {
            // Gets the current visitor's contact
            ContactInfo currentContact = contactTrackingService.GetCurrentContactAsync(User.Identity.Name).Result;

            var consentListingModel = new ConsentListingModel();

            // Does not attempt to load consent data if the current contact is not available
            // This occurs if contact tracking is disabled, or for visitors who have not given an agreement with the tracking consent
            if (currentContact != null)
            {
                // Gets all consents for which the current contact has given an agreement
                consentListingModel.Consents = consentAgreementService.GetAgreedConsents(currentContact);
            }

            return(View(consentListingModel));
        }
Exemple #2
0
 private IEnumerable <PrivacyConsentViewModel> GetAgreedConsentsForCurrentContact()
 {
     return(consentAgreementService.GetAgreedConsents(CurrentContact)
            .Select(consent => new PrivacyConsentViewModel
     {
         Name = consent.Name,
         Title = consent.DisplayName,
         Text = consent.GetConsentText(Thread.CurrentThread.CurrentCulture.Name).ShortText
     }));
 }