コード例 #1
0
        public JsonResult Verify(string slug, string code)
        {
            string result = "Error";
            // validate the code.

            string decrypted = EncryptionUtility.DecryptString(code, _encryptionKey);

            if (decrypted != null)
            {
                // convert the json back to an object.
                ViewModels.NewsletterConfirmation newsletterConfirmation = JsonConvert.DeserializeObject <ViewModels.NewsletterConfirmation>(decrypted);
                // check that the slugs match.
                if (slug.Equals(newsletterConfirmation.slug))
                {
                    _dynamicsClient.AddNewsletterSubscriber(slug, newsletterConfirmation.email.ToLower());
                    result = "Success";
                }
            }
            return(new JsonResult(result));
        }