public ViewResult Posts(int?page) { int pageSize = 10; int pageNumber = (page ?? 1); var posts = _blogRepository.PostsList(); if (posts.Count > 0) { return(View(posts.ToPagedList(pageNumber, pageSize))); } else { return(View()); } }
public WidgetViewModel(IPosts blogRepository) { Categories = blogRepository.CategoriesList(); LatestPosts = blogRepository.PostsList(); }