Ejemplo n.º 1
0
        public string ExtractVirtualPath(string path, RouteValueDictionary values)
        {
            var pathArray = path.Split("/", StringSplitOptions.RemoveEmptyEntries);

            string[] urls = _articleTypeWidgetService.GetRelatedPageUrls();
            if (pathArray.Length > 1 && urls.Any(m => m.Length < path.Length && path.StartsWith(m, StringComparison.InvariantCultureIgnoreCase)))
            {
                var articleType = _articleTypeService.GetByUrl(pathArray[pathArray.Length - 1]);
                if (articleType != null)
                {
                    var url = pathArray[pathArray.Length - 1];
                    values.SetCategoryUrl(url);
                    values.SetCategory(articleType.ID);
                    path = $"/{string.Join("/", pathArray, 0, pathArray.Length - 1)}";
                }
            }
            return(path);
        }
Ejemplo n.º 2
0
        public string ExtractVirtualPath(string path, RouteValueDictionary values)
        {
            var pathArray = path.Split("/", StringSplitOptions.RemoveEmptyEntries);

            if (pathArray.Length > 1)
            {
                var articleType = _articleTypeService.GetByUrl(pathArray[pathArray.Length - 1]);
                if (articleType != null)
                {
                    var url = pathArray[pathArray.Length - 1];
                    if (!values.ContainsKey(StringKeys.RouteVale_CategoryUrl))
                    {
                        values.Add(StringKeys.RouteVale_CategoryUrl, url);
                    }
                    if (!values.ContainsKey(StringKeys.RouteValue_Category))
                    {
                        values.Add(StringKeys.RouteValue_Category, articleType.ID);
                    }
                    path = $"/{string.Join("/", pathArray, 0, pathArray.Length - 1)}";
                }
            }
            return(path);
        }
Ejemplo n.º 3
0
 public ArticleType GetByName(string name)
 {
     return(_articleTypeService.GetByUrl(name));
 }