예제 #1
0
        /// <summary>
        /// Adds a custom bread crumb to the list
        /// </summary>
        public static bool AddBreadCrumb(this PageModel pageModel, Action <BreadCrumb> breadCrumbAction)
        {
            var breadCrumb = new BreadCrumb();

            breadCrumbAction(breadCrumb);
            return(pageModel.AddBreadCrumb(breadCrumb));
        }
예제 #2
0
        /// <summary>
        /// Adds a custom bread crumb to the list
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="breadCrumbAction"></param>
        public static bool AddBreadCrumb(this Controller ctx, Action <BreadCrumb> breadCrumbAction)
        {
            var breadCrumb = new BreadCrumb();

            breadCrumbAction(breadCrumb);
            return(ctx.AddBreadCrumb(breadCrumb));
        }
예제 #3
0
        /// <summary>
        /// Adds a custom bread crumb to the list
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="breadCrumb"></param>
        public static bool AddBreadCrumb(this Controller ctx, BreadCrumb breadCrumb)
        {
            if (ctx == null)
            {
                return(false);
            }

            ctx.HttpContext.AddBreadCrumb(breadCrumb);

            return(true);
        }
예제 #4
0
        /// <summary>
        /// Adds a custom bread crumb to the list
        /// </summary>
        /// <param name="ctx"></param>
        /// <param name="breadCrumb"></param>
        public static bool AddBreadCrumb(this HttpContext ctx, BreadCrumb breadCrumb)
        {
            if (ctx == null)
            {
                return(false);
            }

            var currentBreadCrumbs = ctx.Items[CurrentBreadCrumbKey] as List <BreadCrumb> ?? new List <BreadCrumb>();

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

            currentBreadCrumbs.Add(breadCrumb);
            ctx.Items[CurrentBreadCrumbKey] = currentBreadCrumbs;

            return(true);
        }
예제 #5
0
 /// <summary>
 /// Adds a custom bread crumb to the list
 /// </summary>
 public static bool AddBreadCrumb(this PageModel pageModel, BreadCrumb breadCrumb)
 {
     pageModel.HttpContext.AddBreadCrumb(breadCrumb);
     return(true);
 }