예제 #1
0
        public string Url(INavigatable navigatable, Action<RouteValueDictionary> configurator)
        {
            RouteValueDictionary routeValues = PrepareRouteValues(navigatable.RouteValues);
            configurator(routeValues);

            return navigatable.GenerateUrl(grid.ViewContext, grid.UrlGenerator, routeValues);
        }
예제 #2
0
        public static bool IsCurrent(this INavigatable navigatable, ViewContext viewContext)
        {
            string pathAndQuery = viewContext.HttpContext.Request.Url.PathAndQuery;
            string url          = navigatable.GenerateUrl(viewContext.RequestContext);
            string comparing    = new UrlHelper(viewContext.RequestContext).RouteUrl(viewContext.RequestContext.RouteData.Values);

            return(url.IsCaseInsensitiveEqual(pathAndQuery) || url.IsCaseInsensitiveEqual(comparing));
        }
예제 #3
0
        public static string GenerateUrl(this INavigatable navigatable, ActionContext actionContext)
        {
            Guard.NotNull(actionContext, nameof(actionContext));

            return(navigatable.GenerateUrl(
                       actionContext.HttpContext.GetServiceScope().Resolve <IUrlHelper>(),
                       actionContext.RouteData.Values));
        }
예제 #4
0
        public string Url(INavigatable navigatable, Action <RouteValueDictionary> configurator)
        {
            RouteValueDictionary routeValues = PrepareRouteValues(navigatable.RouteValues);

            configurator(routeValues);

            return(navigatable.GenerateUrl(grid.ViewContext, grid.UrlGenerator, routeValues));
        }
예제 #5
0
        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));
        }
예제 #6
0
        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 static bool IsCurrent(this INavigatable navigatable, ControllerContext controllerContext)
        {
            var url = navigatable.GenerateUrl(controllerContext.RequestContext)?.ToLower();

            if (url.IsEmpty())
            {
                return(false);
            }

            var compare = GetCurrentPathInfo(controllerContext);

            if (url == compare.RequestPath || url == compare.RoutePath)
            {
                return(true);
            }

            return(false);
        }
예제 #8
0
        public static bool IsCurrent(this INavigatable navigatable, ActionContext actionContext)
        {
            // TODO: (mh) (core) Test this thoroughly!
            var url = navigatable.GenerateUrl(actionContext)?.ToLower();

            if (url.IsEmpty())
            {
                return(false);
            }

            var compare = GetCurrentPathInfo(actionContext);

            if (url == compare.RequestPath || url == compare.RoutePath)
            {
                return(true);
            }

            return(false);
        }
 private void SetUrl(INavigatable operation)
 {
     operation.Url = operation.GenerateUrl(viewContext, urlGenerator);
 }
 private void SetUrl(INavigatable operation)
 {
     operation.Url = operation.GenerateUrl(viewContext, urlGenerator);
 }
예제 #11
0
        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);
        }
예제 #12
0
 private Uri GenerateUrl(INavigatable navigatable)
 {
     var routeValues = PrepareRouteData(navigatable.RouteValues);
     return navigatable.GenerateUrl(grid.ViewContext, grid.UrlGenerator, routeValues);
 }
예제 #13
0
 public string PrepareUrl(INavigatable navigatable)
 {
     return(navigatable.GenerateUrl(viewContext, urlGenerator));
 }
예제 #14
0
 public string PrepareUrl(INavigatable navigatable)
 {
     return navigatable.GenerateUrl(viewContext, urlGenerator);
 }
 public static string GenerateUrl(this INavigatable navigatable, RequestContext requestContext, RouteValueDictionary routeValues = null)
 {
     return(navigatable.GenerateUrl(new UrlHelper(requestContext), routeValues));
 }
예제 #16
0
        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);
        }
예제 #17
0
        public static string GenerateUrl(this INavigatable navigatable, ActionContext actionContext)
        {
            var urlHelper = actionContext.HttpContext.GetServiceScope().Resolve <IUrlHelperFactory>().GetUrlHelper(actionContext);

            return(navigatable.GenerateUrl(urlHelper, actionContext.RouteData.Values));
        }