示例#1
0
        public void SetFeaturesForSite(Site site)
        {
            if (site.Features.Count > 0)
             {
            log.WarnFormat("Can't add Features to siteid {0} because it already has {1} features", site.SiteId.ToString(), site.Features.Count.ToString());
            throw new ApplicationException("Site already has features!");
             }

             IList<Feature> features = FindAll();

             foreach (Feature feature in features)
             {
            SiteFeature sf = new SiteFeature()
                                {
                                   Site = site,
                                   Feature = feature,
                                   Enabled = false,
                                   StartDate = DateTime.Now.ToUniversalTime(),
                                   EndDate = null
                                };
            site.Features.Add(sf);
             }

             siteService.SaveSite(site);
        }
示例#2
0
 public void SaveSiteFeature(SiteFeature siteFeature)
 {
     Repository<SiteFeature>.Save(siteFeature);
 }