/// <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)); }
/// <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)); }
/// <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); }
/// <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); }
/// <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); }