コード例 #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
ファイル: GridUrlBuilder.cs プロジェクト: wanaxe/Study
        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
ファイル: GridUrlBuilder.cs プロジェクト: wanaxe/Study
        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
ファイル: GridUrlBuilder.cs プロジェクト: wanaxe/Study
        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));
        }
コード例 #7
0
        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);
        }
コード例 #9
0
 private void SetUrl(INavigatable operation)
 {
     operation.Url = operation.GenerateUrl(viewContext, urlGenerator);
 }
コード例 #10
0
 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
ファイル: GridUrlHelper.cs プロジェクト: VlaTo/EmpRe.NET
 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);
 }
コード例 #15
0
 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));
        }