Beispiel #1
0
        public SettingsViewModel GetSettingsViewModel(Guid candidateId)
        {
            try
            {
                _logger.Debug("Calling AccountProvider to get Settings View Model for candidate with Id={0}", candidateId);

                var candidate = _candidateService.GetCandidate(candidateId);
                var settings  = _mapper.Map <RegistrationDetails, SettingsViewModel>(candidate.RegistrationDetails);
                settings.AllowEmailComms     = candidate.CommunicationPreferences.AllowEmail;
                settings.AllowSmsComms       = candidate.CommunicationPreferences.AllowMobile;
                settings.VerifiedMobile      = candidate.CommunicationPreferences.VerifiedMobile;
                settings.SmsEnabled          = _featureToggle.IsActive(Feature.Sms);
                settings.AllowEmailMarketing = candidate.CommunicationPreferences.AllowEmailMarketing;
                settings.AllowSmsMarketing   = candidate.CommunicationPreferences.AllowMobileMarketing;
                return(settings);
            }
            catch (Exception e)
            {
                var message =
                    string.Format(
                        "Unexpected error while getting settings view model on AccountProvider for candidate with Id={0}.",
                        candidateId);
                _logger.Error(message, e);
                throw;
            }
        }