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 = EnumToObject(typeof(MixPageType)), ModuleTypes = EnumToObject(typeof(MixModuleType)), AttributeSetTypes = EnumToObject(typeof(MixAttributeSetDataType)), DataTypes = EnumToObject(typeof(MixDataType)), Statuses = EnumToObject(typeof(MixContentStatus)), 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 = 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(), Statuses = Enum.GetNames(typeof(MixContentStatus)).ToList() }; 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("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 }); }