public string Url(INavigatable navigatable, Action<RouteValueDictionary> configurator) { RouteValueDictionary routeValues = PrepareRouteValues(navigatable.RouteValues); configurator(routeValues); return navigatable.GenerateUrl(grid.ViewContext, grid.UrlGenerator, routeValues); }
public Uri Generate(RequestContext requestContext, INavigatable navigatable, RouteValueDictionary routeValues) { if (requestContext == null) { throw new ArgumentNullException(nameof(requestContext)); } if (navigatable == null) { throw new ArgumentNullException(nameof(navigatable)); } var urlHelper = new UrlHelper(requestContext); if (!String.IsNullOrEmpty(navigatable.RouteName)) { return new Uri(uriString: urlHelper.RouteUrl(navigatable.RouteName, routeValues)); } if (!String.IsNullOrEmpty(navigatable.ControllerName) && !String.IsNullOrEmpty(navigatable.ActionName)) { return new Uri(uriString: urlHelper.Action(navigatable.ActionName, navigatable.ControllerName, routeValues), uriKind: UriKind.Relative); } if (routeValues.Any()) { return new Uri(uriString: urlHelper.RouteUrl(routeValues)); } return null; }
public string Generate(RequestContext requestContext, INavigatable navigationItem, RouteValueDictionary routeValues) { Guard.IsNotNull(requestContext, "requestContext"); Guard.IsNotNull(navigationItem, "navigationItem"); UrlHelper urlHelper = new UrlHelper(requestContext); string generatedUrl = null; if (!string.IsNullOrEmpty(navigationItem.RouteName)) { generatedUrl = urlHelper.RouteUrl(navigationItem.RouteName, routeValues); } else if (!string.IsNullOrEmpty(navigationItem.ControllerName) && !string.IsNullOrEmpty(navigationItem.ActionName)) { generatedUrl = urlHelper.Action(navigationItem.ActionName, navigationItem.ControllerName, routeValues, null, null); } else if (!string.IsNullOrEmpty(navigationItem.Url)) { generatedUrl = navigationItem.Url.StartsWith("~/", StringComparison.Ordinal) ? urlHelper.Content(navigationItem.Url) : navigationItem.Url; } else if (routeValues.Any()) { generatedUrl = urlHelper.RouteUrl(routeValues); } return generatedUrl; }
public string Url(INavigatable navigatable, string key, object value) { RouteValueDictionary routeValues = PrepareRouteValues(navigatable.RouteValues); routeValues[grid.Prefix(key)] = value; return Url(routeValues); }
public static void Apply(this RouteValueDictionary source, INavigatable navigatable, Action<INavigatable, string, string, RouteValueDictionary> callback) { object controllerName; object actionName; var routeValues = new RouteValueDictionary(); ExtractControllerAndActionParams(routeValues, out controllerName, out actionName, source); callback(navigatable, (string) actionName, (string) controllerName, routeValues); }
public Uri Generate(RequestContext requestContext, INavigatable navigatable) { var routeValues = new RouteValueDictionary(); if (navigatable.RouteValues.Any()) { routeValues.Merge(navigatable.RouteValues); } return Generate(requestContext, navigatable, routeValues); }
public string Generate(RequestContext requestContext, INavigatable navigationItem) { RouteValueDictionary routeValues = new RouteValueDictionary(); if (navigationItem.RouteValues.Any()) { routeValues.Merge(navigationItem.RouteValues); } return Generate(requestContext, navigationItem, routeValues); }
public bool IsAccessibleToUser(RequestContext requestContext, INavigatable navigationItem) { bool isAllowed = true; if (!string.IsNullOrEmpty(navigationItem.RouteName)) { isAllowed = controllerAuthorization.IsAccessibleToUser(requestContext, navigationItem.RouteName); } else if (!string.IsNullOrEmpty(navigationItem.ControllerName) && !string.IsNullOrEmpty(navigationItem.ActionName)) { isAllowed = controllerAuthorization.IsAccessibleToUser(requestContext, navigationItem.ControllerName, navigationItem.ActionName, navigationItem.RouteValues); } return isAllowed; }
private static void SetAction(INavigatable navigatable, string actionName, string controllerName, RouteValueDictionary routeValues) { navigatable.ActionName = actionName; navigatable.ControllerName = controllerName; navigatable.SetRouteValues((IDictionary<string, object>)routeValues); }
private void SetUrl(INavigatable operation) { operation.Url = operation.GenerateUrl(viewContext, urlGenerator); }
private static void ApplyRoute(INavigatable navigatable,string controllerName,string actionName,RouteValueDictionary routeValues) { navigatable.ControllerName = controllerName; navigatable.ActionName = actionName; navigatable.SetRouteValues(routeValues); }
public string Url(INavigatable navigatable, bool copy) { var routeValues = new RouteValueDictionary(navigatable.RouteValues); if (copy) { routeValues = PrepareRouteValues(navigatable.RouteValues); } return navigatable.GenerateUrl(grid.ViewContext, grid.UrlGenerator, routeValues); }
public string Url(INavigatable navigatable) { return Url(navigatable, true); }
public static void Action(this INavigatable navigatable, string actionName, string controllerName, object routeValues) { navigatable.ControllerName = controllerName; navigatable.ActionName = actionName; navigatable.SetRouteValues(routeValues); }
public static void Route(this INavigatable navigatable, string routeName, object routeValues) { navigatable.RouteName = routeName; navigatable.SetRouteValues(routeValues); }
public static void Route(this INavigatable navigatable, string routeName, RouteValueDictionary routeValues) { navigatable.RouteName = routeName; navigatable.SetRouteValues(routeValues); }
private Uri GenerateUrl(INavigatable navigatable) { var routeValues = PrepareRouteData(navigatable.RouteValues); return navigatable.GenerateUrl(grid.ViewContext, grid.UrlGenerator, routeValues); }
private string GetUrl(INavigatable node, HttpContextBase httpContext, string applicationRoot) { string url = urlGenerator.Generate(httpContext.RequestContext(), node); if (!string.IsNullOrEmpty(url)) { if (!url.StartsWith("/", StringComparison.Ordinal)) { url = "/" + url; } url = applicationRoot + url; } return url; }
public string PrepareUrl(INavigatable navigatable) { return navigatable.GenerateUrl(viewContext, urlGenerator); }
public string Url(INavigatable navigatable, string key, object value) { RouteValueDictionary routeValues = PrepareRouteValues(navigatable.RouteValues); routeValues[grid.Prefix(key)] = value; return navigatable.GenerateUrl(grid.ViewContext, grid.UrlGenerator, routeValues); }
public AutoMoveNavMesh(INavigatable pNavigatable) : base(pNavigatable) { Init(); }