示例#1
0
        protected override void DeleteInternal(string configName, int id)
        {
            var conf     = GetConfig(configName);
            var newLinks = conf.Links.Where(x => x.Id != id).ToArray();
            var newConf  = new LinkConfig(newLinks, configName);

            Save(configName, newConf);
        }
示例#2
0
        public void Save(string configName, Link link)
        {
            var config = GetConfig(configName);

            if (link.Id == 0)
            {
                link.Id = config.GetNewId();
            }
            var newLinks  = config.Links.Where(x => x.Id != link.Id).Append(link).ToArray();
            var newConfig = new LinkConfig(newLinks, configName);

            SaveInternal(configName, newConfig);
            cachedConfigs.Remove(configName);
        }