public async Task <ActionResult> Index(int tagId, int pageNum, string searchString) { HomeViewModel myHomeViewModel = new HomeViewModel(); IEnumerable <BlogPost> blogPostsToAdd = await _blogPostRepository.ListAllAsync(); myHomeViewModel.BlogPosts = blogPostsToAdd.ToList(); myHomeViewModel.Authors = await _authorRepository.ListAllAsync(); myHomeViewModel.BlogTags = await _blogTagRepository.ListAllAsync(); myHomeViewModel.BlogTagsApplied = await _blogTagAppliedRepository.ListAllAsync(); myHomeViewModel.SiteUrl = _appSettings.Value.SiteUrl; myHomeViewModel.PageNum = pageNum; myHomeViewModel.BlogPosts.Reverse(); if (searchString != null) { myHomeViewModel.BlogTag = null; myHomeViewModel.BlogPosts = SearchPosts.GetPostsBySearchString(searchString, myHomeViewModel); myHomeViewModel.searchString = searchString; } else if (tagId == 0) { myHomeViewModel.BlogTag = null; } else { GetPostsByTag(tagId, myHomeViewModel); } return(View(myHomeViewModel)); }
// GET: AuthorController public async Task <ActionResult> Index() { PostListViewModel myPostListViewModel = new PostListViewModel(); IEnumerable <BlogPost> blogPostsToAdd = await _blogPostRepository.ListAllAsync(); myPostListViewModel.BlogPosts = blogPostsToAdd.ToList(); myPostListViewModel.Authors = await _authorRepository.ListAllAsync(); myPostListViewModel.BlogTags = await _blogTagRepository.ListAllAsync(); myPostListViewModel.BlogTagsApplied = await _blogTagAppliedRepository.ListAllAsync(); myPostListViewModel.SiteUrl = _appSettings.Value.SiteUrl; return(View(myPostListViewModel)); }
// GET: AuthorController public async Task <ActionResult> Index() { var listOfBlogTags = await _blogTagRepository.ListAllAsync(); return(View(listOfBlogTags)); }