예제 #1
0
        public bool DeleteById(params Guid[] id)
        {
            Guard.NotEmpty(id, nameof(id));
            var result = true;

            foreach (var item in id)
            {
                var deleted = _webResourceRepository.FindById(item);
                if (deleted == null)
                {
                    return(false);
                }
                //检查依赖项
                _dependencyChecker.CheckAndThrow <Domain.WebResource>(WebResourceDefaults.ModuleName, deleted.WebResourceId);
                bool flag = _webResourceRepository.DeleteById(item);
                if (flag)
                {
                    //删除依赖项
                    _dependencyService.DeleteByDependentId(WebResourceDefaults.ModuleName, id);
                    //solution component
                    _solutionComponentService.DeleteObject(deleted.SolutionId, deleted.WebResourceId, WebResourceDefaults.ModuleName);
                    //localization
                    _localizedLabelService.DeleteByObject(item);
                    _cacheService.RemoveEntity(deleted);
                }
            }
            return(result);
        }
예제 #2
0
        public Domain.WebResource FindById(Guid id, bool IsPublished = true)
        {
            var data = _webResourceRepository.FindById(id);

            if (data != null)
            {
                WrapLocalizedLabel(data);
            }
            return(data);
        }