コード例 #1
0
        private static string GetBlogListTitle(string tags, int totalItems)
        {
            var rm = new ResourceManager("Resources.Blog", Assembly.Load("App_GlobalResources"));

            var title = rm.GetString("List_AllBlogsTitle");

            if (!string.IsNullOrEmpty(tags))
            {
                var separator = rm.GetString("List_SelectedTagsTitle_Separator");
                title = BlogFacade.Decode(tags.Replace(",", separator));
                if (totalItems == 0)
                {
                    title = rm.GetString("List_SelectedTagsTitle_NoFound").FormatWith(title);
                }
            }
            return(title);
        }
コード例 #2
0
        private Expression <Func <Entries, bool> > GetBlogFilter(GetBlogEntriesParameter param)
        {
            Expression <Func <Entries, bool> > filter;

            if (!string.IsNullOrEmpty(param.Tags))
            {
                var tagsList = param.Tags.Split(',').Select(i => BlogFacade.Decode(i)).ToList();
                filter =
                    f =>
                    Enumerable.Intersect(f.Tags.Split(','), tagsList).Count() == tagsList.Count &&
                    (param.BlogPageId == Guid.Empty || f.PageId == param.BlogPageId);
            }
            else
            {
                filter = f => param.BlogPageId == Guid.Empty || f.PageId == param.BlogPageId;
            }

            return(filter);
        }