public static MvcHtmlString ActionLinkFor <TController>(this HtmlHelper helper, string text, Expression <Func <TController, ActionResult> > actionDef, object routeValues, IDictionary <string, object> htmlAttributes) where TController : IController { return(helper.ActionLinkFor(text, actionDef, new RouteValueDictionary(routeValues), htmlAttributes)); }
public static MvcHtmlString ActionLinkFor <TController>(this HtmlHelper helper, Expression <Func <TController, ActionResult> > actionDef, IDictionary <string, object> htmlAttributes, bool generateRouteValues = true) where TController : IController { var method = StaticReflection.GetMember(actionDef) as ICallableMember; var display = method.GetCustomAttribute <DisplayAttribute>(); var text = display != null?display.GetName() ?? method.Name : method.Name; var methodExp = actionDef.Body as MethodCallExpression; IDictionary <string, object> routeVals = null; if (generateRouteValues) { routeVals = GetRouteValuesFromMethodCall(methodExp); } return(helper.ActionLinkFor(text, actionDef, new RouteValueDictionary(routeVals), htmlAttributes)); }
public static MvcHtmlString ActionLinkFor <TController>(this HtmlHelper helper, string text, Expression <Func <TController, ActionResult> > actionDef, object routeValues) where TController : IController { return(helper.ActionLinkFor(text, actionDef, routeValues, null)); }
public static MvcHtmlString ActionLinkFor <TController>(this HtmlHelper html, Expression <Func <TController, Task <ActionResult> > > expr, string linkText) where TController : IController { return(html.ActionLinkFor <TController, ActionResult>(expr, linkText)); }