public IActionResult ChangeContactPreferencesGet()
        {
            ControllerHelper.ThrowIfAdminIsImpersonatingUser(User);

            // Get the current user
            User currentUser = ControllerHelper.GetGpgUserFromAspNetUser(User, dataRepository);

            // Fill the viewModel with the current user's information
            var viewModel = new ChangeContactPreferencesViewModel
            {
                SendUpdates  = currentUser.SendUpdates,
                AllowContact = currentUser.AllowContact
            };

            // Return the Change Contact Preferences form
            return(View("ChangeContactPreferences", viewModel));
        }
        public IActionResult ChangeContactPreferencesPost(ChangeContactPreferencesViewModel viewModel)
        {
            ControllerHelper.ThrowIfAdminIsImpersonatingUser(User);

            // Get the user db entry
            User currentUser = ControllerHelper.GetGpgUserFromAspNetUser(User, dataRepository);

            // Update the user's information
            currentUser.SendUpdates  = viewModel.SendUpdates;
            currentUser.AllowContact = viewModel.AllowContact;

            // Save updates
            dataRepository.SaveChanges();

            string nextPageUrl = Url.Action("ManageAccountGet", "ManageAccount");

            StatusMessageHelper.SetStatusMessage(Response, "Saved changes to contact preferences", nextPageUrl);

            // Return user to the Manage Account page
            return(LocalRedirect(nextPageUrl));
        }