public int SaveSite(ISite site) { if (site.Id == 0) { // //NOTO:创建站点时应创建一个ROOT栏目节点 // int siteId = siteDal.CreateSite(site); if (siteId == -1) { throw new ArgumentException("创建站点失败"); } else { //清理缓存 RepositoryDataCache._siteDict = null; RepositoryDataCache._categories = null; } } else { if (siteDal.UpdateSite(site) != 1) { throw new ArgumentException("站点不存在,保存失败"); } //清理缓存 RepositoryDataCache._siteDict = null; RepositoryDataCache._categories = null; } return(site.Id); }
public int SaveSite(ISite site) { if (site.GetAggregaterootId() == 0) { int siteId = siteDal.CreateSite(site); int rootCategoryId = this._categoryRep.GetNewCategoryId(siteId); if (siteId <= 0) { throw new ArgumentException("创建站点失败"); } } else { if (siteDal.UpdateSite(site) != 1) { throw new ArgumentException("站点不存在,保存失败"); } } //清理缓存 RepositoryDataCache._siteDict = null; RepositoryDataCache._categories = null; return(site.GetAggregaterootId()); }
public int SaveSite(ISite site) { var siteId = site.GetAggregateRootId(); if (site.GetAggregateRootId() <= 0) { siteId = siteDal.CreateSite(site); if (siteId <= 0) { throw new ArgumentException("创建站点失败"); } } else { if (siteDal.UpdateSite(site) != 1) { throw new ArgumentException("站点不存在,保存失败"); } } //清理缓存 RepositoryDataCache._siteDict = null; RepositoryDataCache._categories = null; return(siteId); }