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

TotalPosts() public method

Return total no. of all or published posts.
public TotalPosts ( bool checkIsPublished = true ) : int
checkIsPublished bool True to count only published posts
return int
        public int TotalPosts(bool checkIsPublished = true)
        {
            return _session.Query<Post>().Where(p => !checkIsPublished || p.Published == true).Count();
        }