public RepositoryResponse <JObject> Languages()
 {
     return(new RepositoryResponse <JObject>()
     {
         IsSucceed = true,
         Data = SioService.GetTranslator(_lang)
     });
 }
Example #2
0
        private RepositoryResponse <JObject> getAllSettings()
        {
            var cultures = CommonRepository.Instance.LoadCultures();
            var culture  = cultures.FirstOrDefault(c => c.Specificulture == _lang);

            // Get Settings
            GlobalSettingsViewModel configurations = new GlobalSettingsViewModel()
            {
                Domain                  = SioService.GetConfig <string>(SioConstants.ConfigurationKeyword.Domain),
                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(),
                ModuleTypes             = Enum.GetNames(typeof(SioModuleType)).ToList(),
                DataTypes               = Enum.GetNames(typeof(SioDataType)).ToList(),
                Statuses                = Enum.GetNames(typeof(SioContentStatus)).ToList(),
                LastUpdateConfiguration = SioService.GetConfig <DateTime?>("LastUpdateConfiguration")
            };

            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("langIcon", configurations.LangIcon),

                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
            });
        }