//TODO: Put this logic in the Translation Layer? public bool SaveCommunicationPrefs(string token, AccountInfo accountInfo) { var contactId = _authenticationService.GetContactId(token); var contact = MinistryPlatformService.GetRecordDict(Convert.ToInt32(ConfigurationManager.AppSettings["MyContact"]), contactId, token); try { var emailsmsDict = getDictionary(new EmailSMSOptOut { Contact_ID = contactId, Bulk_Email_Opt_Out = accountInfo.EmailNotifications, Bulk_SMS_Opt_Out = accountInfo.TextNotifications }); var mailDict = getDictionary(new MailOptOut { Household_ID = (int)contact["Household_ID"], Bulk_Mail_Opt_Out = accountInfo.PaperlessStatements }); _communicationService.SetEmailSMSPreferences(token, emailsmsDict); _communicationService.SetMailPreferences(token, mailDict); return true; } catch (Exception e) { throw e; } }
public AccountInfo getAccountInfo(string token) { var contactId = _authenticationService.GetContactId(token); CommunicationPreferences contact = _communicationService.GetPreferences(token, contactId); var accountInfo = new AccountInfo { EmailNotifications = contact.Bulk_Email_Opt_Out, TextNotifications = contact.Bulk_SMS_Opt_Out, PaperlessStatements = contact.Bulk_Mail_Opt_Out }; return accountInfo; }