/// <inheritdoc /> public virtual string Action(UrlActionContext actionContext) { var valuesDictionary = PropertyHelper.ObjectToDictionary(actionContext.Values); if (actionContext.Action == null) { object action; if (!valuesDictionary.ContainsKey("action") && AmbientValues.TryGetValue("action", out action)) { valuesDictionary["action"] = action; } } else { valuesDictionary["action"] = actionContext.Action; } if (actionContext.Controller == null) { object controller; if (!valuesDictionary.ContainsKey("controller") && AmbientValues.TryGetValue("controller", out controller)) { valuesDictionary["controller"] = controller; } } else { valuesDictionary["controller"] = actionContext.Controller; } var path = GeneratePathFromRoute(valuesDictionary); if (path == null) { return(null); } return(GenerateUrl(actionContext.Protocol, actionContext.Host, path, actionContext.Fragment)); }
/// <inheritdoc /> public virtual string Action(UrlActionContext actionContext) { var valuesDictionary = PropertyHelper.ObjectToDictionary(actionContext.Values); if (actionContext.Action == null) { object action; if (!valuesDictionary.ContainsKey("action") && AmbientValues.TryGetValue("action", out action)) { valuesDictionary["action"] = action; } } else { valuesDictionary["action"] = actionContext.Action; } if (actionContext.Controller == null) { object controller; if (!valuesDictionary.ContainsKey("controller") && AmbientValues.TryGetValue("controller", out controller)) { valuesDictionary["controller"] = controller; } } else { valuesDictionary["controller"] = actionContext.Controller; } var path = GeneratePathFromRoute(valuesDictionary); if (path == null) { return null; } return GenerateUrl(actionContext.Protocol, actionContext.Host, path, actionContext.Fragment); }
/// <inheritdoc /> public virtual string Action(UrlActionContext actionContext) { var valuesDictionary = PropertyHelper.ObjectToDictionary(actionContext.Values); if (actionContext.Action != null) { valuesDictionary["action"] = actionContext.Action; } if (actionContext.Controller != null) { valuesDictionary["controller"] = actionContext.Controller; } var path = GeneratePathFromRoute(valuesDictionary); if (path == null) { return null; } return GenerateUrl(actionContext.Protocol, actionContext.Host, path, actionContext.Fragment); }
public void UrlActionWithUrlActionContext_ReturnsExpectedResult() { // Arrange var services = GetServices(); var urlHelper = CreateUrlHelperWithRouteCollection(services, "/app"); var actionContext = new UrlActionContext() { Action = "contact", Controller = "home3", Values = new { id = "idone" }, Protocol = "ftp", Host = "remotelyhost", Fragment = "somefragment" }; // Act var url = urlHelper.Action(actionContext); // Assert Assert.Equal("ftp://remotelyhost/app/home3/contact/idone#somefragment", url); }
/// <inheritdoc /> public virtual string Action(UrlActionContext actionContext) { var valuesDictionary = PropertyHelper.ObjectToDictionary(actionContext.Values); if (actionContext.Action != null) { valuesDictionary["action"] = actionContext.Action; } if (actionContext.Controller != null) { valuesDictionary["controller"] = actionContext.Controller; } var path = GeneratePathFromRoute(valuesDictionary); if (path == null) { return(null); } return(GenerateUrl(actionContext.Protocol, actionContext.Host, path, actionContext.Fragment)); }
public override string Action(UrlActionContext actionContext) { return ConvertToLowercaseUrl(base.Action(actionContext)); }
public string Action(UrlActionContext actionContext) { throw new NotImplementedException(); }