Ejemplo n.º 1
0
        public async Task <ActionResult> ControlPanelConfig_Partial(Model model)
        {
            using (ControlPanelConfigDataProvider dataProvider = new ControlPanelConfigDataProvider()) {
                ControlPanelConfigData origConfig = await dataProvider.GetItemAsync();// get the original item

                if (!ModelState.IsValid)
                {
                    return(PartialView(model));
                }
                ControlPanelConfigData config = await dataProvider.GetItemAsync();

                config = model.GetData(config); // merge new data into config
                model.SetData(config);          // and all the data back into model for final display

                await dataProvider.UpdateConfigAsync(config);

                ObjectSupport.ModelDisposition modelDisp = ObjectSupport.EvaluateModelChanges(origConfig, config);
                switch (modelDisp)
                {
                default:
                case ObjectSupport.ModelDisposition.None:
                    return(FormProcessed(model, this.__ResStr("okSaved", "Control Panel settings saved")));

                case ObjectSupport.ModelDisposition.PageReload:
                    return(FormProcessed(model, this.__ResStr("okSaved", "Control Panel settings saved"), OnClose: OnCloseEnum.ReloadPage, OnPopupClose: OnPopupCloseEnum.ReloadParentPage, ForceRedirect: true));

                case ObjectSupport.ModelDisposition.SiteRestart:
                    return(FormProcessed(model, this.__ResStr("okSavedRestart", "Control Panel settings saved - These settings won't take effect until the site is restarted")));
                }
            }
        }
Ejemplo n.º 2
0
        public async Task <ActionResult> SiteProperties_Partial(SitePropertiesModel model)
        {
            SiteDefinition origSite;

            if (model.SiteHost == null)
            {
                origSite = Manager.CurrentSite;
            }
            else
            {
                origSite = await SiteDefinition.LoadSiteDefinitionAsync(model.SiteHost);
            }
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }
            ObjectSupport.CopyDataFromOriginal(origSite, model.Site);
            await model.Site.SaveAsync();

            ObjectSupport.ModelDisposition modelDisp = ObjectSupport.EvaluateModelChanges(origSite, model.Site);
            switch (modelDisp)
            {
            default:
            case ObjectSupport.ModelDisposition.None:
                return(FormProcessed(model, this.__ResStr("okSaved", "Site settings updated")));

            case ObjectSupport.ModelDisposition.PageReload:
                return(FormProcessed(model, this.__ResStr("okSaved", "Site settings updated"), OnClose: OnCloseEnum.ReloadPage, OnPopupClose: OnPopupCloseEnum.ReloadParentPage, ForceRedirect: true));

            case ObjectSupport.ModelDisposition.SiteRestart:
                return(FormProcessed(model, this.__ResStr("okSavedRestart", "Site settings updated - These settings won't take effect until the site is restarted")));
            }
        }
Ejemplo n.º 3
0
        public async Task <ActionResult> SkinSelection_Partial(SkinSelectionModel model)
        {
            if (!ModelState.IsValid)
            {
                return(PartialView(model));
            }

            SiteDefinition origSite = new SiteDefinition();

            ObjectSupport.CopyData(Manager.CurrentSite, origSite); // make a copy of original site
            SiteDefinition site = Manager.CurrentSite;             // update new settings

            site.BootstrapSkin = model.BootstrapSkin;
            site.jQueryUISkin  = model.jQueryUISkin;
            site.KendoUISkin   = model.KendoUISkin;
            ObjectSupport.ModelDisposition modelDisp = ObjectSupport.EvaluateModelChanges(origSite, site);
            switch (modelDisp)
            {
            default:
            case ObjectSupport.ModelDisposition.None:
                return(FormProcessed(model, this.__ResStr("okSaved", "Site settings updated")));

            case ObjectSupport.ModelDisposition.PageReload:
                await site.SaveAsync();

                return(FormProcessed(model, this.__ResStr("okSaved", "Site settings updated"), OnClose: OnCloseEnum.ReloadPage, OnPopupClose: OnPopupCloseEnum.ReloadParentPage, ForceRedirect: true));

            case ObjectSupport.ModelDisposition.SiteRestart:
                await site.SaveAsync();

                return(FormProcessed(model, this.__ResStr("okSavedRestart", "Site settings updated - These settings won't take effect until the site is restarted")));
            }
        }