Пример #1
0
        //EndDocSection:Revoke

        //DocSection:Details
        /// <summary>
        /// Display details of the specified consent.
        /// </summary>
        public ActionResult ConsentDetails(int consentId)
        {
            // Gets a list of consents for which the current contact has given an agreement
            ContactInfo           currentContact = contactTrackingService.GetCurrentContactAsync(User.Identity.Name).Result;
            IEnumerable <Consent> consents       = consentAgreementService.GetAgreedConsents(currentContact);

            // Gets the consent matching the identifier for which the details were requested
            // Using this approach to get objects of the 'Consent' class is necessary to ensure that the correct consent text
            // is displayed, either from the current consent text or the archived consent version for which the agreement was given
            Consent consent = consents.FirstOrDefault(c => c.Id == consentId);

            // Displays the privacy page (consent list) if the specified consent identifier is not valid
            if (consent == null)
            {
                return(View("Index"));
            }

            // Sets the consent's details into the view model
            var model = new ConsentDetailsModel
            {
                ConsentDisplayName = consent.DisplayName,
                ConsentShortText   = consent.GetConsentText("en-US").ShortText,
                ConsentFullText    = consent.GetConsentText("en-US").FullText
            };

            return(View(model));
        }