@using Microsoft.AspNetCore.Components.Routing @using Oqtane.Client.Modules.Controls @using Oqtane.Models @using Oqtane.Services @using Oqtane.Modules @using Oqtane.Shared @using Oqtane.Security @inherits ModuleBase @inject IUriHelper UriHelper @inject IPageService PageService @inject IThemeService ThemeService
Cancel

@code { public override SecurityAccessLevel SecurityAccessLevel { get { return SecurityAccessLevel.Admin; } } string message = ""; Dictionary themes = new Dictionary(); Dictionary panelayouts = new Dictionary(); int PageId; string name; string path; string parentid; string order; string isnavigation; string themetype; string layouttype; string icon; string permissions; string createdby; DateTime createdon; string modifiedby; DateTime modifiedon; PermissionGrid permissiongrid; protected override void OnInitialized() { try { themes = ThemeService.GetThemeTypes(PageState.Themes); panelayouts = ThemeService.GetPaneLayoutTypes(PageState.Themes); PageId = Int32.Parse(PageState.QueryString["id"]); Page page = PageState.Pages.Where(item => item.PageId == PageId).FirstOrDefault(); if (page != null) { name = page.Name; path = page.Path; if (page.ParentId == null) { parentid = ""; } else { parentid = page.ParentId.ToString(); } order = page.Order.ToString(); isnavigation = page.IsNavigation.ToString(); themetype = page.ThemeType; layouttype = page.LayoutType; icon = page.Icon; permissions = page.Permissions; createdby = page.CreatedBy; createdon = page.CreatedOn; modifiedby = page.ModifiedBy; modifiedon = page.ModifiedOn; } } catch (Exception ex) { message = ex.Message; } } private async Task SavePage() { try { Page page = PageState.Page; page.PageId = Int32.Parse(PageState.QueryString["id"]); if (string.IsNullOrEmpty(parentid)) { page.ParentId = null; } else { page.ParentId = Int32.Parse(parentid); } page.Name = name; page.Path = path; page.Order = (order == null ? 1 : Int32.Parse(order)); page.IsNavigation = (isnavigation == null ? true : Boolean.Parse(isnavigation)); page.ThemeType = themetype; page.LayoutType = (layouttype == null ? "" : layouttype); page.Icon = (icon == null ? "" : icon); Type type; if (!string.IsNullOrEmpty(layouttype)) { type = Type.GetType(layouttype); } else { type = Type.GetType(themetype); } System.Reflection.PropertyInfo property = type.GetProperty("Panes"); page.Panes = (string)property.GetValue(Activator.CreateInstance(type), null); page.Permissions = permissiongrid.GetPermissions(); await PageService.UpdatePageAsync(page); PageState.Reload = Constants.ReloadSite; if (PageState.Page.Name == "Page Management") { UriHelper.NavigateTo(NavigateUrl()); } else { UriHelper.NavigateTo(NavigateUrl(path)); } } catch (Exception ex) { message = ex.Message; } } }