本文整理汇总了C#中IBlogRepository.TotalPostsForTag方法的典型用法代码示例。如果您正苦于以下问题:C# IBlogRepository.TotalPostsForTag方法的具体用法?C# IBlogRepository.TotalPostsForTag怎么用?C# IBlogRepository.TotalPostsForTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBlogRepository
的用法示例。
在下文中一共展示了IBlogRepository.TotalPostsForTag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ListPostViewModel
public ListPostViewModel(IBlogRepository blogRepository, string text, string type, int pageNo)
{
_blogRepository = blogRepository;
switch (type)
{
case "Category":
{
Posts = _blogRepository.PostsForCategory(text, pageNo - 1, itemsPerPage);
TotalPosts = _blogRepository.TotalPostsForCategory(text);
Category = _blogRepository.Category(text);
PagingInfo = new PagingInfo
{
CurrentPage = pageNo,
ItemsPerPage = itemsPerPage,
TotalItems = TotalPosts,
CurrentCategory = text
};
break;
}
case "Tag":
{
Posts = _blogRepository.PostsForTags(text, pageNo - 1, itemsPerPage);
TotalPosts = _blogRepository.TotalPostsForTag(text);
Tag = _blogRepository.Tag(text);
CurrentTag = Tag.Name;
PagingInfo = new PagingInfo
{
CurrentPage = pageNo,
ItemsPerPage = itemsPerPage,
TotalItems = TotalPosts,
CurrentTag = text
};
break;
}
default:
{
Posts = _blogRepository.PostsForSearch(text, pageNo - 1, itemsPerPage);
TotalPosts = _blogRepository.TotalPostsForSearch(text);
CurrentSearchString = text;
PagingInfo = new PagingInfo
{
CurrentPage = pageNo,
ItemsPerPage = itemsPerPage,
TotalItems = TotalPosts,
CurrentSearchString = text
};
break;
}
}
}
示例2: ListViewModel
public ListViewModel(IBlogRepository blogRepository, string text, string type, int pageNumber)
{
switch (type)
{
case "Category":
Posts = blogRepository.PostsForCategory(text, pageNumber - 1, 10);
TotalPosts = blogRepository.TotalPostsForCategory(text);
Category = blogRepository.Category(text);
break;
case "Tag":
Posts = blogRepository.PostsForTag(text, pageNumber - 1, 10);
TotalPosts = blogRepository.TotalPostsForTag(text);
Tag = blogRepository.Tag(text);
break;
default:
Posts = blogRepository.SearchPosts(text, pageNumber - 1, 10);
TotalPosts = blogRepository.TotalSearchPosts(text);
break;
}
}
示例3: ListViewModel
public ListViewModel(IBlogRepository repo, string text, string type, int pageNumber)
{
switch(type)
{
case "Category":
Posts = repo.GetPostsForCategory(text, pageNumber, ConfigUtil.ReadFromConfig(Constants.PAGE_SIZE));
TotalPosts = repo.TotalPostsForCategory(text);
Category = repo.Category(text);
break;
case "Tag":
Posts = repo.GetPostsForTag(text, pageNumber, ConfigUtil.ReadFromConfig(Constants.PAGE_SIZE));
TotalPosts = repo.TotalPostsForTag(text);
Tag = repo.Tag(text);
break;
default:
Posts = repo.GetPostsForSearch(text, pageNumber, ConfigUtil.ReadFromConfig(Constants.PAGE_SIZE));
TotalPosts = repo.TotalPostsForSearch(text);
Search = text;
break;
}
}
示例4: ListViewModel
/// <summary>
/// The List View Model constructor for categories and tags
/// </summary>
/// <param name="blogRepository"></param>
/// <param name="text"></param>
/// <param name="postType"></param>
/// <param name="page"></param>
public ListViewModel(IBlogRepository blogRepository, string text, string postType, int page)
{
// improvement: make postType a type and overload this method depending on type passed in
switch (postType.ToLower())
{
case "category":
this.Posts = blogRepository.PostsForCategory(text, page - 1, 10);
this.TotalPosts = blogRepository.TotalPostsForCategory(text);
this.Category = blogRepository.Category(text);
break;
case "tag":
this.Posts = blogRepository.PostsForTag(text, page - 1, 10);
this.TotalPosts = blogRepository.TotalPostsForTag(text);
this.Tag = blogRepository.Tag(text);
break;
default:
this.Posts = blogRepository.PostsForSearch(text, page - 1, 10);
this.TotalPosts = blogRepository.TotalPostsForSearch(text);
this.Search = text;
break;
}
}