Exemple #1
0
        public int SaveSite(ISite site)
        {
            if (site.Id == 0)
            {
                int siteId         = siteDal.CreateSite(site);
                int rootCategoryId = this._categoryRep.GetNewCategoryId(siteId);
                if (!(siteId != -1 && siteDal.InitRootCategory(siteId, rootCategoryId)))
                {
                    throw new ArgumentException("创建站点失败");
                }
            }
            else
            {
                if (siteDal.UpdateSite(site) != 1)
                {
                    throw new ArgumentException("站点不存在,保存失败");
                }
            }


            //清理缓存
            RepositoryDataCache._siteDict   = null;
            RepositoryDataCache._categories = null;

            return(site.Id);
        }