public RepositoryResponse <JObject> Languages()
 {
     return(new RepositoryResponse <JObject>()
     {
         IsSucceed = true,
         Data = MixService.GetTranslator(_lang)
     });
 }
        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
            });
        }
Example #4
0
        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
            });
        }