代码拉取完成,页面将自动刷新
同步操作将从 OrchardCore/Orchard-Training-Demo-Module 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
using Lombiq.HelpfulLibraries.OrchardCore.Navigation;
using Lombiq.TrainingDemo.Controllers;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Localization;
using OrchardCore.Mvc.Core.Utilities;
using OrchardCore.Navigation;
using System;
namespace Lombiq.TrainingDemo.Navigation;
// This provider creates "main" type navigation entries. These are not used by Orchard Core itself, but you can call
// it from custom code. You can retrieve them with INavigationManager.BuildMenuAsync("main", ActionContext). If you
// use the Lombiq.HelpfulExtensions.Widgets feature, it has a MenuWidget which can accept the MenuItem collection
// returned by this method call and display a Bootstrap "navbar" wherever you need a menu. Or if you use a theme
// which extends Lombiq.BaseTheme, then it already displays your "main" navigation entries as a MenuWidget on its
// own. Yes, this is basically an ad for our other projects. :)
//
// For details on how to use them, see the Lombiq.BaseTheme.Samples project:
// https://github.com/Lombiq/Orchard-Base-Theme/tree/issue/OSOE-62/Lombiq.BaseTheme.Samples
public class TrainingDemoNavigationProvider : MainMenuNavigationProviderBase
{
public TrainingDemoNavigationProvider(
IHttpContextAccessor hca,
IStringLocalizer<TrainingDemoNavigationProvider> stringLocalizer)
: base(hca, stringLocalizer)
{
}
protected override void Build(NavigationBuilder builder)
{
var context = _hca.HttpContext;
builder
.Add(T["Training Demo"], builder => builder
.AddLabel(T["Your First OrchardCore Controller"])
.Add(T["Index"], subMenu => subMenu
.Action<YourFirstOrchardCoreController>(context, controller => controller.Index()))
.Add(T["Notify Me"], subMenu => subMenu
.ActionTask<YourFirstOrchardCoreController>(context, controller => controller.NotifyMe()))
.AddSeparator(T)
.AddLabel(T["Display Management"])
.Add(T["Display Book"], subMenu => subMenu
.ActionTask<DisplayManagementController>(context, controller => controller.DisplayBook()))
.Add(T["Display Book Description"], subMenu => subMenu
.ActionTask<DisplayManagementController>(context, controller => controller.DisplayBookDescription()))
.AddSeparator(T)
.AddLabel(T["Database Storage"])
.Add(T["Create Books"], subMenu => subMenu
.Action<DatabaseStorageController>(context, controller => controller.CreateBooks()))
.Add(T["J. K. Rosenzweig Books"], subMenu => subMenu
.ActionTask<DatabaseStorageController>(context, controller => controller.JKRosenzweigBooks()))
.AddSeparator(T)
.AddLabel(T["Person List"])
.Add(T["Older Than 30"], subMenu => subMenu
.ActionTask<PersonListController>(context, controller => controller.OlderThan30()))
.Add(T["Fountain of Eternal Youth"], subMenu => subMenu
.Action(
nameof(PersonListController.FountainOfEternalYouth),
typeof(PersonListController).ControllerName(),
"Lombiq.TrainingDemo"))
.Add(T["Create an Android"], subMenu => subMenu
.Action(
nameof(PersonListController.CreateAnAndroid),
typeof(PersonListController).ControllerName(),
"Lombiq.TrainingDemo"))
.AddSeparator(T)
.AddLabel(T["Authorization"])
.Add(T["CanEditPerson"], subMenu => subMenu
.ActionTask<AuthorizationController>(context, controller => controller.CanEditPerson()))
.Add(T["CanManagePersons"], subMenu => subMenu
.ActionTask<AuthorizationController>(context, controller => controller.CanManagePersons()))
.AddSeparator(T)
.AddLabel(T["Admin"])
.Add(T["Index"], subMenu => subMenu
.Action<AdminController>(context, controller => controller.Index()))
.Add(T["Person List (Newest)"], subMenu => subMenu
.ActionTask<AdminController>(context, controller => controller.PersonListNewest()))
.Add(T["Person List (Oldest)"], subMenu => subMenu
.ActionTask<AdminController>(context, controller => controller.PersonListOldest()))
.AddSeparator(T)
.AddLabel(T["Site Settings"])
.Add(T["Site Name"], Action<SiteSettingsController>(nameof(SiteSettingsController.SiteName)))
.Add(T["Demo Settings"], Action<SiteSettingsController>(nameof(SiteSettingsController.DemoSettings)))
.AddSeparator(T)
.AddLabel(T["File Management"])
.Add(T["Create File in Media Folder"], Action<FileManagementController>(nameof(FileManagementController.CreateFileInMediaFolder)))
.Add(T["Read File from Media Folder"], Action<FileManagementController>(nameof(FileManagementController.ReadFileFromMediaFolder)))
.Add(T["Upload File to Media"], Action<FileManagementController>(nameof(FileManagementController.UploadFileToMedia)))
.Add(T["Create File in Custom Folder"], Action<FileManagementController>(nameof(FileManagementController.CreateFileInCustomFolder)))
.AddSeparator(T)
.AddLabel(T["API (Not for front end.)"])
.AddSeparator(T)
.Add(T["Cross Tenant Services"], Action<CrossTenantServicesController>(nameof(CrossTenantServicesController.Index))));
}
private static Action<NavigationItemBuilder> Action<T>(string actionName) =>
subMenu => subMenu.Action(actionName, typeof(T).ControllerName(), "Lombiq.TrainingDemo");
}
// END OF TRAINING SECTION: Navigation menus
// NEXT STATION: Controllers/SiteSettingsController.cs
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。