// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using Microsoft.AspNet.Html.Abstractions; using Microsoft.AspNet.Mvc.ViewFeatures; using Microsoft.Framework.Internal; namespace Microsoft.AspNet.Mvc.Rendering { /// /// Link-related extensions for . /// public static class HtmlHelperLinkExtensions { /// /// Returns an anchor (<a>) element that contains a URL path to the specified action. /// /// The instance this method extends. /// The inner text of the anchor element. Must not be null. /// The name of the action. /// A new containing the anchor element. public static IHtmlContent ActionLink( [NotNull] this IHtmlHelper helper, [NotNull] string linkText, string actionName) { return helper.ActionLink( linkText, actionName, controllerName: null, protocol: null, hostname: null, fragment: null, routeValues: null, htmlAttributes: null); } /// /// Returns an anchor (<a>) element that contains a URL path to the specified action. /// /// The instance this method extends. /// The inner text of the anchor element. Must not be null. /// The name of the action. /// /// An that contains the parameters for a route. The parameters are retrieved through /// reflection by examining the properties of the . This is typically /// created using initializer syntax. Alternatively, an /// instance containing the route /// parameters. /// /// A new containing the anchor element. public static IHtmlContent ActionLink( [NotNull] this IHtmlHelper helper, [NotNull] string linkText, string actionName, object routeValues) { return helper.ActionLink( linkText, actionName, controllerName: null, protocol: null, hostname: null, fragment: null, routeValues: routeValues, htmlAttributes: null); } /// /// Returns an anchor (<a>) element that contains a URL path to the specified action. /// /// The instance this method extends. /// The inner text of the anchor element. Must not be null. /// The name of the action. /// /// An that contains the parameters for a route. The parameters are retrieved through /// reflection by examining the properties of the . This is typically /// created using initializer syntax. Alternatively, an /// instance containing the route /// parameters. /// /// /// An that contains the HTML attributes for the element. Alternatively, an /// instance containing the HTML /// attributes. /// /// A new containing the anchor element. public static IHtmlContent ActionLink( [NotNull] this IHtmlHelper helper, [NotNull] string linkText, string actionName, object routeValues, object htmlAttributes) { return helper.ActionLink( linkText, actionName, controllerName: null, protocol: null, hostname: null, fragment: null, routeValues: routeValues, htmlAttributes: htmlAttributes); } /// /// Returns an anchor (<a>) element that contains a URL path to the specified action. /// /// The instance this method extends. /// The inner text of the anchor element. Must not be null. /// The name of the action. /// The name of the controller. /// A new containing the anchor element. public static IHtmlContent ActionLink( [NotNull] this IHtmlHelper helper, [NotNull] string linkText, string actionName, string controllerName) { return helper.ActionLink( linkText, actionName, controllerName, protocol: null, hostname: null, fragment: null, routeValues: null, htmlAttributes: null); } /// /// Returns an anchor (<a>) element that contains a URL path to the specified action. /// /// The instance this method extends. /// The inner text of the anchor element. Must not be null. /// The name of the action. /// The name of the controller. /// /// An that contains the parameters for a route. The parameters are retrieved through /// reflection by examining the properties of the . This is typically /// created using initializer syntax. Alternatively, an /// instance containing the route /// parameters. /// /// A new containing the anchor element. public static IHtmlContent ActionLink( [NotNull] this IHtmlHelper helper, [NotNull] string linkText, string actionName, string controllerName, object routeValues) { return helper.ActionLink( linkText, actionName, controllerName, protocol: null, hostname: null, fragment: null, routeValues: routeValues, htmlAttributes: null); } /// /// Returns an anchor (<a>) element that contains a URL path to the specified action. /// /// The instance this method extends. /// The inner text of the anchor element. Must not be null. /// The name of the action. /// The name of the controller. /// /// An that contains the parameters for a route. The parameters are retrieved through /// reflection by examining the properties of the . This is typically /// created using initializer syntax. Alternatively, an /// instance containing the route /// parameters. /// /// /// An that contains the HTML attributes for the element. Alternatively, an /// instance containing the HTML /// attributes. /// /// A new containing the anchor element. public static IHtmlContent ActionLink( [NotNull] this IHtmlHelper helper, [NotNull] string linkText, string actionName, string controllerName, object routeValues, object htmlAttributes) { return helper.ActionLink( linkText, actionName, controllerName, protocol: null, hostname: null, fragment: null, routeValues: routeValues, htmlAttributes: htmlAttributes); } /// /// Returns an anchor (<a>) element that contains a URL path to the specified route. /// /// The instance this method extends. /// The inner text of the anchor element. Must not be null. /// /// An that contains the parameters for a route. The parameters are retrieved through /// reflection by examining the properties of the . This is typically /// created using initializer syntax. Alternatively, an /// instance containing the route /// parameters. /// /// A new containing the anchor element. public static IHtmlContent RouteLink( [NotNull] this IHtmlHelper htmlHelper, [NotNull] string linkText, object routeValues) { return htmlHelper.RouteLink( linkText, routeName: null, protocol: null, hostName: null, fragment: null, routeValues: routeValues, htmlAttributes: null); } /// /// Returns an anchor (<a>) element that contains a URL path to the specified route. /// /// The instance this method extends. /// The inner text of the anchor element. Must not be null. /// The name of the route. /// A new containing the anchor element. public static IHtmlContent RouteLink( [NotNull] this IHtmlHelper htmlHelper, [NotNull] string linkText, string routeName) { return htmlHelper.RouteLink( linkText, routeName, protocol: null, hostName: null, fragment: null, routeValues: null, htmlAttributes: null); } /// /// Returns an anchor (<a>) element that contains a URL path to the specified route. /// /// The instance this method extends. /// The inner text of the anchor element. Must not be null. /// The name of the route. /// /// An that contains the parameters for a route. The parameters are retrieved through /// reflection by examining the properties of the . This is typically /// created using initializer syntax. Alternatively, an /// instance containing the route /// parameters. /// /// A new containing the anchor element. public static IHtmlContent RouteLink( [NotNull] this IHtmlHelper htmlHelper, [NotNull] string linkText, string routeName, object routeValues) { return htmlHelper.RouteLink( linkText, routeName, protocol: null, hostName: null, fragment: null, routeValues: routeValues, htmlAttributes: null); } /// /// Returns an anchor (<a>) element that contains a URL path to the specified route. /// /// The instance this method extends. /// The inner text of the anchor element. Must not be null. /// /// An that contains the parameters for a route. The parameters are retrieved through /// reflection by examining the properties of the . This is typically /// created using initializer syntax. Alternatively, an /// instance containing the route /// parameters. /// /// /// An that contains the HTML attributes for the element. Alternatively, an /// instance containing the HTML /// attributes. /// /// A new containing the anchor element. public static IHtmlContent RouteLink( [NotNull] this IHtmlHelper htmlHelper, [NotNull] string linkText, object routeValues, object htmlAttributes) { return htmlHelper.RouteLink( linkText, routeName: null, protocol: null, hostName: null, fragment: null, routeValues: routeValues, htmlAttributes: htmlAttributes); } /// /// Returns an anchor (<a>) element that contains a URL path to the specified route. /// /// The instance this method extends. /// The inner text of the anchor element. Must not be null. /// The name of the route. /// /// An that contains the parameters for a route. The parameters are retrieved through /// reflection by examining the properties of the . This is typically /// created using initializer syntax. Alternatively, an /// instance containing the route /// parameters. /// /// /// An that contains the HTML attributes for the element. Alternatively, an /// instance containing the HTML /// attributes. /// /// A new containing the anchor element. public static IHtmlContent RouteLink( [NotNull] this IHtmlHelper htmlHelper, [NotNull] string linkText, string routeName, object routeValues, object htmlAttributes) { return htmlHelper.RouteLink( linkText, routeName, protocol: null, hostName: null, fragment: null, routeValues: routeValues, htmlAttributes: htmlAttributes); } } }