Exemplo n.º 1
0
        public static List <BreadCrumb> ForShopCategory(int categoryId)
        {
            IShopCategoryService shopCategoryService = DependencyResolver.Current.GetService <IShopCategoryService>();
            IList <Category>     categories          = shopCategoryService.GetParentCategoriesWithCurrent(categoryId);
            List <BreadCrumb>    result = new List <BreadCrumb>();
            UrlHelper            helper = new UrlHelper(HttpContext.Current.Request.RequestContext);

            foreach (var category in categories)
            {
                result.Add(new BreadCrumb()
                {
                    Title  = category.Name,
                    Url    = helper.RouteUrl("CatalogSEF", new { relativeURL = category.CanonicalUrl }),
                    IsLast = categories.Last() == category
                });
            }
            return(result);
        }