当前位置: 首页>>代码示例>>C#>>正文


C# IBlogRepository.Tag方法代码示例

本文整理汇总了C#中IBlogRepository.Tag方法的典型用法代码示例。如果您正苦于以下问题:C# IBlogRepository.Tag方法的具体用法?C# IBlogRepository.Tag怎么用?C# IBlogRepository.Tag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IBlogRepository的用法示例。


在下文中一共展示了IBlogRepository.Tag方法的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;
             }
     }
 }
开发者ID:silne30,项目名称:TPCv3,代码行数:50,代码来源:ListPostViewModel.cs

示例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;
     }
 }
开发者ID:Beton,项目名称:Blog4Net,代码行数:20,代码来源:ListViewModel.cs

示例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;
     }
 }
开发者ID:sundeepkamath,项目名称:MyBlog,代码行数:21,代码来源:ListViewModel.cs

示例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;
     }
 }
开发者ID:JavaJoe127,项目名称:CooksBlog,代码行数:29,代码来源:ListViewModel.cs


注:本文中的IBlogRepository.Tag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。