/// <summary> /// 删除文章 /// </summary> /// <param name="id">文章Id</param> public void DeleteArticle(Guid id) { Article article = this._repMediator.ArticleRepository.SingleOrDefault(id); if (article == null) { throw new InvalidOperationException("操作失败 , 文章Id不存在 !"); } ArticleCategory category = this._unitOfWork.Resolve <ArticleCategory>(article.ArticleCategory.Id); if (category == null) { throw new InvalidOperationException("操作失败 , 文章分类Id不存在 !"); } category.RemoveArticle(id); this._unitOfWork.RegisterRemove <Article>(id); this._unitOfWork.RegisterSave(category); this._unitOfWork.Commit(); }