Ejemplo n.º 1
0
        public void CreateCurrentSiteSettings(SiteSettings siteSettings)
        {
            if (siteSettings == null)
            {
                throw new ArgumentNullException(nameof(siteSettings));
            }

            var siteSettingsEntity = new SiteSettingsEntity()
            {
                BaseUrl              = siteSettings.BaseUrl,
                Calendar             = siteSettings.Calendar,
                Culture              = siteSettings.Culture,
                MaxPagedCount        = siteSettings.MaxPagedCount,
                MaxPageSize          = siteSettings.MaxPageSize,
                PageSize             = siteSettings.PageSize,
                SiteName             = siteSettings.SiteName,
                SiteSalt             = siteSettings.SiteSalt,
                SuperUser            = siteSettings.SuperUser,
                TimeZone             = siteSettings.TimeZone,
                UseCdn               = siteSettings.UseCdn,
                ResourceDebugMode    = siteSettings.ResourceDebugMode,
                HomeRoute_Controller = GetControllerByHomeRoute(siteSettings.HomeRoute),
                HomeRoute_Action     = GetActionByHomeRoute(siteSettings.HomeRoute),
                HomeRoute_Area       = GetAreaByHomeRoute(siteSettings.HomeRoute)
            };

            SiteSettingsEntitySet.Add(siteSettingsEntity);
            SaveChanges();
        }
Ejemplo n.º 2
0
        public void UpdateCurrentSiteSettings(SiteSettings siteSettings)
        {
            if (siteSettings == null)
            {
                throw new ArgumentNullException(nameof(siteSettings));
            }
            var siteSettingsEntity = SiteSettingsEntitys.FirstOrDefault();

            if (siteSettingsEntity != null)
            {
                //siteSettingsEntity.Id = siteSettingsEntity.Id,
                siteSettingsEntity.BaseUrl              = siteSettings.BaseUrl;
                siteSettingsEntity.Calendar             = siteSettings.Calendar;
                siteSettingsEntity.Culture              = siteSettings.Culture;
                siteSettingsEntity.MaxPagedCount        = siteSettings.MaxPagedCount;
                siteSettingsEntity.MaxPageSize          = siteSettings.MaxPageSize;
                siteSettingsEntity.PageSize             = siteSettings.PageSize;
                siteSettingsEntity.SiteName             = siteSettings.SiteName;
                siteSettingsEntity.SiteSalt             = siteSettings.SiteSalt;
                siteSettingsEntity.SuperUser            = siteSettings.SuperUser;
                siteSettingsEntity.TimeZone             = siteSettings.TimeZone;
                siteSettingsEntity.UseCdn               = siteSettings.UseCdn;
                siteSettingsEntity.ResourceDebugMode    = siteSettings.ResourceDebugMode;
                siteSettingsEntity.HomeRoute_Controller = GetControllerByHomeRoute(siteSettings.HomeRoute);
                siteSettingsEntity.HomeRoute_Action     = GetActionByHomeRoute(siteSettings.HomeRoute);
                siteSettingsEntity.HomeRoute_Area       = GetAreaByHomeRoute(siteSettings.HomeRoute);

                SiteSettingsEntitySet.Update(siteSettingsEntity);
                SaveChanges();
            }
        }