コード例 #1
0
ファイル: CommonSiteHelper.cs プロジェクト: dKluev/Site
        public static string BreadCrumbs(this ViewMasterPage page)
        {
            var view = page.ViewContext.View as WebFormView;

            if (view == null || page.Model == null)
            {
                return(null);
            }
            var currentMainMenu = MainMenu.GetAll()
                                  .FirstOrDefault(x => x.HasModel(Common.Logic.BreadCrumbs.GetModel(page)));
            var breadCrumbs = new BreadCrumbs(page, currentMainMenu).Get();

            if (breadCrumbs.IsEmpty())
            {
                return(null);
            }
            var sp  = " ";
            var sep = sp + ">" + sp;

            return(breadCrumbs.JoinWith(sep)
                   .Replace(sep + Common.Logic.BreadCrumbs.Separator + sep,
                            sp + Common.Logic.BreadCrumbs.Separator + sp)
                   .Remove(sep + Common.Logic.BreadCrumbs.Separator));
        }