public ActionResult Create() { if (!CheckPermission(DashboardPermissions.ManageModuleSettings)) { return(new HttpUnauthorizedResult()); } WorkContext.Breadcrumbs.Add(T("Extension Modules"), Url.Action("Index", new { area = Constants.Areas.Dashboard })); WorkContext.Breadcrumbs.Add(T("Module Informations")); var model = new ShellFeatureModel(); var result = new ControlFormResult <ShellFeatureModel>(model) { Title = T("Module Informations").Text, UpdateActionName = "Update", CssClass = "form-edit-page", ShowSubmitButton = true, ShowCloseButton = true, ShowBoxHeader = false, FormWrapperStartHtml = Constants.Form.FormWrapperStartHtml, FormWrapperEndHtml = Constants.Form.FormWrapperEndHtml }; return(result); }
public ActionResult Edit(string name) { var model = new ShellFeatureModel { Name = name }; var result = new ControlFormResult <ShellFeatureModel>(model) { Title = T("Module Informations"), UpdateActionName = "Update", FormMethod = FormMethod.Post, SubmitButtonText = T("Save"), ShowCancelButton = true, ShowBoxHeader = false, FormWrapperStartHtml = Constants.Form.FormWrapperStartHtml, FormWrapperEndHtml = Constants.Form.FormWrapperEndHtml }; return(result); }
public ActionResult Update(ShellFeatureModel model) { var service = WorkContext.Resolve <IShellDescriptorManager>(); var setting = service.GetShellDescriptor(); var configuration = WebConfigurationManager.OpenWebConfiguration("~"); var sections = ((CMSConfigurationSection)configuration.GetSection("solutions")).Modules; var element = new ModuleProviderConfigurationElement { Id = model.Name, Name = model.Name, Category = model.Category }; if (setting.Features.Any(item => item.Name == model.Name)) { sections.Remove(element.Id); sections.Add(element); configuration.Save(ConfigurationSaveMode.Modified); return(new AjaxResult().Alert(T("Existing the name."))); } setting.Features.Add(new ShellFeature { Name = model.Name }); service.UpdateShellDescriptor(0, setting.Features); var serviceFile = WorkContext.Resolve <IShellDescriptorCache>(); var st = WorkContext.Resolve <ShellSettings>(); serviceFile.Store(st.Name, setting); sections.Remove(element.Id); sections.Add(element); configuration.Save(ConfigurationSaveMode.Modified); return(new AjaxResult().NotifyMessage("UPDATE_ENTITY_COMPLETE").Alert(T("Save success."))); }