本文整理汇总了C#中IUrlHelper.Action方法的典型用法代码示例。如果您正苦于以下问题:C# IUrlHelper.Action方法的具体用法?C# IUrlHelper.Action怎么用?C# IUrlHelper.Action使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IUrlHelper
的用法示例。
在下文中一共展示了IUrlHelper.Action方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: QuestionListItem
/// <summary>
/// Constructor.
/// </summary>
public QuestionListItem(Model.Questions.Question question, IEnumerable<string> actions, IUrlHelper urlHelper)
{
Name = question.Name;
ActionLinks = string.Join
(
"|",
actions.Select
(
action => $"<a href=\"{urlHelper.Action(action, new { id = question.Id })}\" target=\"_blank\"></a>"
)
);
}
示例2: ResolveUrl
private string ResolveUrl(NavigationNode node, IUrlHelper urlHelper)
{
if (node.HideFromAnonymous) return string.Empty;
// if url is already fully resolved just return it
if (node.Url.StartsWith("http")) return node.Url;
string urlToUse = string.Empty;
if ((node.Action.Length > 0) && (node.Controller.Length > 0))
{
urlToUse = urlHelper.Action(node.Action, node.Controller);
}
else if (node.NamedRoute.Length > 0)
{
urlToUse = urlHelper.RouteUrl(node.NamedRoute);
}
if (string.IsNullOrEmpty(urlToUse)) urlToUse = node.Url;
if (urlToUse.StartsWith("http")) return urlToUse;
return BaseUrl + urlToUse;
}
示例3: GetDataSeriesArray
/// <summary>
/// Returns a serializable array for the given series.
/// </summary>
public object GetDataSeriesArray(IUrlHelper urlHelper, bool passed)
{
var dayBoundaries = GetDayBoundaries();
var lastBuild = AllBuildTestCounts.Last();
var totalTests = lastBuild.PassedCount + lastBuild.FailedCount;
return AllBuildTestCounts.Select
(
(value, index) => new
{
Index = index,
TestCount = passed
? value.PassedCount
: totalTests - value.PassedCount,
ShortCommitDate = dayBoundaries[index]
? value.PushDate.ToLocalTime().ToString("MM/dd")
: "--",
LongCommitDate = value.PushDate.ToLocalTime().ToString("MM/dd/yyyy h:mm tt"),
BuildUrl = urlHelper.Action
(
"BuildResult",
"Build",
new { buildId = value.BuildId }
)
}
);
}