JustBlog.Core.BlogRepository.TotalPostsForTag C# (CSharp) Method

TotalPostsForTag() public method

Return total no. of posts belongs to a particular tag.
public TotalPostsForTag ( string tagSlug ) : int
tagSlug string Tag's url slug
return int
        public int TotalPostsForTag(string tagSlug)
        {
            return _session.Query<Post>()
                     .Where(p => p.Published && p.Tags.Any(t => t.UrlSlug.Equals(tagSlug)))
                     .Count();
        }