public IActionResult Index(string query = null, int pageIndex = 1) { pageIndex = pageIndex < 1 ? 1 : pageIndex; var indexPostVM = new IndexPostVM { PostCount = _postRepo.Count(query), Posts = _postRepo.GetPaginated(pageIndex, true, query), Query = query }; return(View(indexPostVM)); }