public bool DeleteArchive(int archiveId) { var archive = GetArchiveById(archiveId); if (archive == null) { return(false); } if (FlagAnd(archive.Get().Flag, BuiltInArchiveFlags.IsSystem)) { throw new NotSupportedException("系统文档,不允许删除,请先取消系统设置后再进行删除!"); } var result = _archiveRep.DeleteArchive(SiteId, archive.GetAggregateRootId()); if (result) { //删除模板绑定 _tempRep.RemoveBind(archive.GetAggregateRootId(), TemplateBindType.ArchiveTemplate); } // //TODO:删除评论及点评 // //删除评论 // new CommentDAL().DeleteArchiveComments(archiveID); //删除点评 //new CommentBLL().DeleteArchiveReviews(archiveID); archive = null; return(result); }
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); }