Exemplo n.º 1
0
 private static void WriteBaseSettingModelValues(BaseSettingModel model, SettingEntity entity)
 {
     model.Name = entity.Name;
     model.Guid = entity.Guid;
     model.SettingKey = entity.SettingKey;
     model.Value = entity.Value;
     model.IsImmutable = entity.IsImmutable;
 }
Exemplo n.º 2
0
        public static BaseSettingModel Convert(SettingEntity entity)
        {
            BaseSettingModel model = null;
            if (entity.SettingValueType == SettingValueType.Int)
                model = new IntSettingModel();
            else if (entity.SettingValueType == SettingValueType.Text)
                model = new TextSettingModel();
            else if (entity.SettingValueType == SettingValueType.Select)
                model = new SelectSettingModel()
                {
                    PossibleValues = entity.PossibleValues
                };
            else if (entity.SettingValueType == SettingValueType.TrueOrFalse)
                model = new TrueOrFalseSettingModel()
                {
                    OnContent = entity.OnContent,
                    OffContent = entity.OffContent
                };
            else
                return null;

            WriteBaseSettingModelValues(model, entity);
            return model;
        }
Exemplo n.º 3
0
 public static void AddSetting(SettingEntity entity)
 {
     var model = EntityModelConverter.Convert(entity);
     AddSetting(model);
 }