Beispiel #1
0
        public Error DeleteCategory(int catId)
        {
            var category = GetCategory(catId);

            if (category == null)
            {
                return(new Error("栏目不存在!"));
            }
            if (category.Childs.Count() != 0)
            {
                return(new Error("栏目包含子栏目!"));
            }
            if (_categoryRep.GetArchiveCount(GetAggregaterootId(), category.Get().Path) != 0)
            {
                return(new Error("栏目包含文档!"));
            }
            foreach (var bind in category.GetTemplates())
            {
                _tempRep.RemoveBind(category.GetDomainId(), bind.BindType);
            }
            _categoryRep.DeleteCategory(GetAggregaterootId(), catId);
            ClearSelf();
            return(null);
        }