示例#1
0
        public SiteSettingManageModel GetSettingManageModel(int id)
        {
            var setting = GetById(id);

            if (setting != null)
            {
                var settingManageModel = new SiteSettingManageModel
                {
                    SettingTypeId = setting.SettingTypeId,
                    SettingTypes  = _settingTypeServices.GetSettingTypes(setting.SettingTypeId),
                    SettingName   = setting.Name
                };
                var settingParsers = ReflectionUtilities.GetAllImplementTypesOfInterface(typeof(ISettingModel));
                foreach (var parser in settingParsers)
                {
                    var instance = (ISettingModel)Activator.CreateInstance(parser);
                    if (instance.SettingName.Equals(setting.Name))
                    {
                        settingManageModel.Setting = instance.LoadSetting();
                        return(settingManageModel);
                    }
                }
                settingManageModel.Setting = setting;
                return(settingManageModel);
            }
            return(null);
        }
示例#2
0
 public JsonResult GetSettingTypes(int?id)
 {
     return(Json(_settingTypeServices.GetSettingTypes(id), JsonRequestBehavior.AllowGet));
 }