GeneralSetting Map(GeneralSettingLocal m)
 {
     if (m == null) return null;
     return new GeneralSetting
     {
         SettingKey = (GeneralSettingKey)m.SettingKey,
         SettingValue = m.SettingValue
     };
 }
        public int Save(GeneralSetting log)
        {
            GeneralSettingLocal setting = new GeneralSettingLocal
            {
                SettingKey = (int)log.SettingKey,
                SettingValue = log.SettingValue
            };

            GeneralSettingLocal exist = _GetByKey(setting.SettingKey);
            if (exist == null)
            {
                exist = new GeneralSettingLocal();
                _ctx.GeneralSettingLocal.Add(exist);
                exist.Id = setting.Id;
                exist.SettingKey = setting.SettingKey;
            }
            exist.SettingValue = setting.SettingValue;
            
            _ctx.SaveChanges();
            return exist.Id;
        }