public async Task <IResponseContent> EditCommunicationPreferencesAsync(EditCommunicationPreferences comm, string tenantUid, string origin, string token) { try { IRestResponse response = await SubmitPostAsync(URL_CHANGE_COMM_PREFERENCES, origin, comm, token, tenantUid); return(await AssertResponseContentAsync <EditCommunicationPreferencesResponseContent>(response)); } catch (Exception ex) { return(new EditCommunicationPreferencesResponseContent { Exception = ex }); } }
public async Task <JsonResult> EditCommunicationPreferences(string tenantUid, string username, string customerToken, string notify = "false", string notifyViaSms = "false", string notifyViaEmail = "false", string notifyViaPlatform = "false") { var notifications = new EditCommunicationPreferences { Username = username, CommunicationPreferences = new CommunicationPreferenceParameter[] { new CommunicationPreferenceParameter { Communication = "Notification", IsSelected = bool.Parse(notify) }, new CommunicationPreferenceParameter { Communication = "TextMessage", IsSelected = bool.Parse(notifyViaSms) }, new CommunicationPreferenceParameter { Communication = "Email", IsSelected = bool.Parse(notifyViaEmail) }, new CommunicationPreferenceParameter { Communication = "InPlatformMessage", IsSelected = bool.Parse(notifyViaPlatform) } } }; var origin = TenantHelper.GetCurrentTenantUrl(contentService, tenantUid); var key = ApiKeyCache.GetByTenantUid(tenantUid); var authorization = await new Authorization().GetAuthorizationAsync(key); var response = await apiService.EditCommunicationPreferencesAsync(notifications, tenantUid, origin, customerToken); return(Json(response, JsonRequestBehavior.DenyGet)); }