示例#1
0
        public void Delete(DeleteOptions options)
        {
            var config = ReadConfig(options);

            var deletedCount = 0;

            foreach (var wrCfg in config)
            {
                _logger.Info($"Processing Web Resource {wrCfg.Name}...");

                var existingResource = _webResourceRepo.Get(wrCfg.Name);
                if (existingResource == null)
                {
                    _logger.Info($"Web Resource {wrCfg.Name} was not found. Skipping.");
                    continue;
                }

                if (_webResourceRepo.CanBeDeleted(existingResource.Id, wrCfg.Name))
                {
                    _webResourceRepo.Delete(existingResource.Id, wrCfg.Name);
                    deletedCount++;
                }
            }

            if (deletedCount == 0)
            {
                return;
            }

            _webResourceRepo.PublishAll();
        }