Ejemplo n.º 1
0
        /// <summary>
        /// Adds a custom bread crumb to the list
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="breadCrumb"></param>
        public static void AddBreadCrumb(this HttpContext ctx, BreadCrumb breadCrumb)
        {
            var currentBreadCrumbs = ctx.Items[CurrentBreadCrumbKey] as List <BreadCrumb> ?? new List <BreadCrumb>();

            if (currentBreadCrumbs.Any(crumb => crumb.Url.Equals(breadCrumb.Url, StringComparison.OrdinalIgnoreCase)))
            {
                return;
            }

            currentBreadCrumbs.Add(breadCrumb);
            ctx.Items[CurrentBreadCrumbKey] = currentBreadCrumbs;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Adds a custom bread crumb to the list
 /// </summary>
 /// <param name="ctx"></param>
 /// <param name="breadCrumb"></param>
 public static void AddBreadCrumb(this Controller ctx, BreadCrumb breadCrumb)
 {
     ctx.HttpContext.AddBreadCrumb(breadCrumb);
 }