public async Task <ActionResult> AddNewModule_Partial(AddNewModuleModel model) { PageDefinition page = await PageDefinition.LoadAsync(model.CurrentPageGuid); if (page == null) { throw new Error("Can't edit this page"); } model.AddData(page); if (!ModelState.IsValid) { return(PartialView(model)); } ModuleDefinition module = ModuleDefinition.CreateNewDesignedModule(model.SelectedModule, model.ModuleName, model.ModuleTitle); if (!module.IsModuleUnique) { module.ModuleGuid = Guid.NewGuid(); } page.AddModule(model.SelectedPane, module, model.ModuleLocation == Location.Top); await page.SaveAsync(); return(Reload(model, PopupText: this.__ResStr("okNew", "New module added"))); }
public async Task <ActionResult> AddExistingModule_Partial(AddExistingModel model) { PageDefinition page = await PageDefinition.LoadAsync(model.CurrentPageGuid); if (page == null) { throw new Error("Can't edit this page"); } model.AddData(page); if (!ModelState.IsValid) { return(PartialView(model)); } ModuleDefinition module = await ModuleDefinition.LoadAsync(model.ExistingModule); page.AddModule(model.ExistingModulePane, module, model.ModuleLocation == Location.Top); await page.SaveAsync(); return(Reload(model, PopupText: this.__ResStr("okExisting", "Module added"))); }