src/NetCoreApp/HtmlExtensions/HtmlHelperExtensions.cs
(完整代码) 1KBusing Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Rendering;
namespace YL.NetCore.HtmlExtensions
{
public static class HtmlHelperExtensions
{
public static HtmlString A(this IHtmlHelper helper)
{
return new HtmlString(helper.ViewContext.RouteData.Values["area"].ToString());
}
public static HtmlString C(this IHtmlHelper helper)
{
return new HtmlString(helper.ViewContext.RouteData.Values["Controller"].ToString());
}
public static HtmlString T(this IHtmlHelper helper)
{
return new HtmlString(helper.ViewContext.RouteData.Values["Action"].ToString());
}
public static HtmlString AC(this IHtmlHelper helper)
{
var areaName = helper.ViewContext.RouteData.Values["area"].ToString();
var controllerName = helper.ViewContext.RouteData.Values["Controller"].ToString();
var actionName = helper.ViewContext.RouteData.Values["Action"].ToString();
return new HtmlString("/" + areaName + "/" + controllerName + "/" + actionName);
}
}
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。