private RepositoryResponse <JObject> getAllSettings() { var cultures = CommonRepository.Instance.LoadCultures(); var culture = cultures.FirstOrDefault(c => c.Specificulture == _lang); // Get Settings GlobalSettingsViewModel configurations = new GlobalSettingsViewModel() { Domain = MixService.GetConfig <string>(MixConstants.ConfigurationKeyword.Domain), Lang = _lang, PortalThemeSettings = MixService.GetConfig <JObject>(MixConstants.ConfigurationKeyword.PortalThemeSettings), ThemeId = MixService.GetConfig <int>(MixConstants.ConfigurationKeyword.ThemeId, _lang), ApiEncryptKey = MixService.GetConfig <string>(MixConstants.ConfigurationKeyword.ApiEncryptKey), ApiEncryptIV = MixService.GetConfig <string>(MixConstants.ConfigurationKeyword.ApiEncryptIV), IsEncryptApi = MixService.GetConfig <bool>(MixConstants.ConfigurationKeyword.IsEncryptApi), Cultures = cultures, PageTypes = Enum.GetNames(typeof(MixPageType)).ToList(), ModuleTypes = Enum.GetNames(typeof(MixModuleType)).ToList(), AttributeSetTypes = Enum.GetNames(typeof(MixAttributeSetType)).ToList(), DataTypes = Enum.GetNames(typeof(MixDataType)).ToList(), Statuses = Enum.GetNames(typeof(MixContentStatus)).ToList(), LastUpdateConfiguration = MixService.GetConfig <DateTime?>("LastUpdateConfiguration") }; configurations.LangIcon = culture?.Icon ?? MixService.GetConfig <string>("Language"); // Get translator var translator = new JObject() { new JProperty("lang", _lang), new JProperty("data", MixService.GetTranslator(_lang)) }; // Get Configurations var settings = new JObject() { new JProperty("lang", _lang), new JProperty("langIcon", configurations.LangIcon), new JProperty("data", MixService.GetLocalSettings(_lang)) }; JObject result = new JObject() { new JProperty("globalSettings", JObject.FromObject(configurations)), new JProperty("translator", translator), new JProperty("settings", JObject.FromObject(settings)) }; return(new RepositoryResponse <JObject>() { IsSucceed = true, Data = result }); }
public RepositoryResponse <JObject> AllSettingsAsync() { var cultures = CommonRepository.Instance.LoadCultures(); var culture = cultures.FirstOrDefault(c => c.Specificulture == _lang); // Get Settings GlobalSettingsViewModel configurations = new GlobalSettingsViewModel() { Lang = _lang, ThemeId = SioService.GetConfig <int>(SioConstants.ConfigurationKeyword.ThemeId, _lang), ApiEncryptKey = SioService.GetConfig <string>(SioConstants.ConfigurationKeyword.ApiEncryptKey), ApiEncryptIV = SioService.GetConfig <string>(SioConstants.ConfigurationKeyword.ApiEncryptIV), IsEncryptApi = SioService.GetConfig <bool>(SioConstants.ConfigurationKeyword.IsEncryptApi), Cultures = cultures, PageTypes = Enum.GetNames(typeof(SioPageType)).ToList(), Statuses = Enum.GetNames(typeof(SioContentStatus)).ToList() }; configurations.LangIcon = culture?.Icon ?? SioService.GetConfig <string>("Language"); // Get translator var translator = new JObject() { new JProperty("lang", _lang), new JProperty("data", SioService.GetTranslator(_lang)) }; // Get Configurations var settings = new JObject() { new JProperty("lang", _lang), new JProperty("data", SioService.GetLocalSettings(_lang)) }; JObject result = new JObject() { new JProperty("globalSettings", JObject.FromObject(configurations)), new JProperty("translator", translator), new JProperty("settings", JObject.FromObject(settings)) }; return(new RepositoryResponse <JObject>() { IsSucceed = true, Data = result }); }
public RepositoryResponse <GlobalSettingsViewModel> Settings() { var cultures = CommonRepository.Instance.LoadCultures(); var culture = cultures.FirstOrDefault(c => c.Specificulture == _lang); GlobalSettingsViewModel settings = new GlobalSettingsViewModel() { Lang = _lang, ThemeId = MixService.GetConfig <int>(MixConstants.ConfigurationKeyword.ThemeId, _lang), Cultures = cultures, PageTypes = Enum.GetNames(typeof(MixPageType)).ToList(), Statuses = Enum.GetNames(typeof(MixContentStatus)).ToList() }; settings.LangIcon = culture?.Icon ?? MixService.GetConfig <string>("Language"); return(new RepositoryResponse <GlobalSettingsViewModel>() { IsSucceed = true, Data = settings }); }
public async Task <IActionResult> General(ulong guildId, GlobalSettingsViewModel vm) { var currentSettings = await _moderationModuleUtils.GetModerationSettings(guildId); currentSettings.Enabled = vm.Enabled; var newChannelState = GetNewChannelState(currentSettings, FilterType.Global, vm.SelectedChannels); var newRolesState = GetNewRolesState(currentSettings, FilterType.Global, vm.SelectedRoles); await _entityServiceWhitelistedChannels.CreateBulk(newChannelState.ChannelsToAdd); await _entityServiceWhitelistedChannels.RemoveBulk(newChannelState.ChannelsToRemove); await _entityServiceWhitelistedRoles.CreateBulk(newRolesState.RolesToAdd); await _entityServiceWhitelistedRoles.RemoveBulk(newRolesState.RolesToRemove); await _moderationSettings.SaveSettings(currentSettings); return(RedirectToAction("general")); }
private RepositoryResponse <JObject> GetAllSettings(string lang = null) { lang ??= MixService.GetAppSetting <string>(MixAppSettingKeywords.DefaultCulture); var cultures = CommonRepository.Instance.LoadCultures(); var culture = cultures.FirstOrDefault(c => c.Specificulture == lang); // Get Settings GlobalSettingsViewModel configurations = new GlobalSettingsViewModel() { Domain = MixService.GetAppSetting <string>(MixAppSettingKeywords.Domain), Lang = lang, PortalThemeSettings = MixService.GetAppSetting <JObject>(MixAppSettingKeywords.PortalThemeSettings), ThemeId = MixService.GetConfig <int>(MixAppSettingKeywords.ThemeId, lang), ApiEncryptKey = MixService.GetAppSetting <string>(MixAppSettingKeywords.ApiEncryptKey), IsEncryptApi = MixService.GetAppSetting <bool>(MixAppSettingKeywords.IsEncryptApi), Cultures = cultures, PageTypes = Enum.GetNames(typeof(MixPageType)), ModuleTypes = Enum.GetNames(typeof(MixModuleType)), MixDatabaseTypes = Enum.GetNames(typeof(MixDatabaseType)), DataTypes = Enum.GetNames(typeof(MixDataType)), Statuses = Enum.GetNames(typeof(MixContentStatus)), RSAKeys = RSAEncryptionHelper.GenerateKeys(), ExternalLoginProviders = new JObject() { new JProperty("Facebook", MixService.Instance.MixAuthentications.Facebook?.AppId), new JProperty("Google", MixService.Instance.MixAuthentications.Google?.AppId), new JProperty("Twitter", MixService.Instance.MixAuthentications.Twitter?.AppId), new JProperty("Microsoft", MixService.Instance.MixAuthentications.Microsoft?.AppId), }, LastUpdateConfiguration = MixService.GetAppSetting <DateTime?>(MixAppSettingKeywords.LastUpdateConfiguration) }; configurations.LangIcon = culture?.Icon ?? MixService.GetAppSetting <string>(MixAppSettingKeywords.Language); // Get translator var translator = new JObject() { new JProperty("lang", lang), new JProperty("data", MixService.GetTranslator(lang)) }; // Get Configurations var localizeSettings = new JObject() { new JProperty("lang", lang), new JProperty("langIcon", configurations.LangIcon), new JProperty("data", MixService.GetLocalizeSettings(lang)) }; JObject result = new JObject() { new JProperty("globalSettings", JObject.FromObject(configurations)), new JProperty("translator", translator), new JProperty("localizeSettings", JObject.FromObject(localizeSettings)) }; return(new RepositoryResponse <JObject>() { IsSucceed = true, Data = result }); }