title: a simple approach for paging and sorting in aspnetboilerplate
body: <p>is there any  simple way for implementing paging in presentation layer in asp.net boilerplate solution like <code>PagedList</code> in <code>PagedList.Mvc</code> Nuget package.</p>
  
  <p>I installed <code>PagedList.Mvc</code> package from Nuget gallery and change my Index method to this :</p>
  
  <pre><code> public async Task&lt;ActionResult&gt; Index(int? page)
          {
              var pageIndex = (page ?? 1) - 1; //NewsService expects a 0 for the first page
              var pageSize = 3;
              int totalUserCount; // will be set by call to GetAllNews due to _out_ paramter :-|
              var newsResult = await _newsAppService.GetAllNews(new PagedResultRequestDto { MaxResultCount = pageSize });
              totalUserCount = newsResult.TotalCount;
  
              var news = newsResult.Items;
              var newsAsIPagedList = new StaticPagedList&lt;NewsDto&gt;(news, pageIndex + 1, pageSize, totalUserCount);
  
              ViewBag.OnePageOfNews = newsAsIPagedList;
  
  
              var model = new NewsListViewModel
              {
                  News = news
              };
  
              return View(model);
          }
  </code></pre>
  
  <p>and in View I add this under the news table :</p>
  
  <pre><code>@Html.PagedListPager((IPagedList)ViewBag.OnePageOfNews, page =&gt; Url.Action("Index", new { page }))
  </code></pre>
  
  <p>but when i click on number for example number 2 or 3 the table refresh but change data.</p>