Exemplo n.º 1
0
        public SystemSetting Get(SystemSettingTypeEnum type, string name)
        {
            SystemSetting result = CSLDbContext.SystemSettings.Where(item =>
                                                                     item.Type == type && string.Equals(name, item.Name, StringComparison.OrdinalIgnoreCase))?.FirstOrDefault();

            return(result);
        }
        public IActionResult Get(SystemSettingTypeEnum settingType)
        {
            switch (settingType)
            {
            case SystemSettingTypeEnum.HomePageSettings:
                HomePageSettingsDto result = this._systemSettingsService.GetHomePageSettings();
                return(Json(result));

            default:
                throw new NotFiniteNumberException();
            }
        }
Exemplo n.º 3
0
        public IActionResult Get(SystemSettingTypeEnum settingType)
        {
            //todo:从系统设置项中独立出首页设置选项。因为系统设置项不应当被未经授权的用户完全获取,而只应当获取用于普通用户的必需配置项。
            switch (settingType)
            {
            case SystemSettingTypeEnum.HomePageSettings:
                return(Json(this._systemSettingsService.GetHomePageSettings()));

            default:
                throw new NotImplementedException();
            }
        }
        public IActionResult Update(SystemSettingTypeEnum settingType, object settings)
        {
            Ensure.NotNull(settings, nameof(settings));

            switch (settingType)
            {
            case SystemSettingTypeEnum.HomePageSettings:
                this._systemSettingsService.UpdateHomePageSettings(Newtonsoft.Json.JsonConvert.DeserializeObject <HomePageSettingsDto>(settings.ToString()));
                break;

            default:
                throw new NotImplementedException();
            }

            return(Ok());
        }
Exemplo n.º 5
0
        private async Task <List <SystemSetting> > ListSettings(SystemSettingTypeEnum settingType)
        {
            List <SystemSetting> settings = await CSLDbContext.SystemSettings.Where(item => item.Type == settingType).AsQueryable().ToListAsync();

            return(settings);
        }
Exemplo n.º 6
0
        private List <SystemSetting> ListSettings(SystemSettingTypeEnum settingType)
        {
            List <SystemSetting> settings = base.CSLDbContext.SystemSettings.Where(item => item.Type == settingType).ToList();

            return(settings);
        }