title: An exception of type 'System.NullReferenceException'
body: <p>This in my action method and I'm getting exception.</p>
  
  <pre><code>public ViewResult List(string category, int page = 1)
  {
      ProductsListViewModel model = new ProductsListViewModel {[enter image description here][1]
          Products = repository.Products
              .Where(p =&gt; category != null || p.Category == category)
              .OrderBy(p =&gt; p.ProductID).Skip((page - 1) * PageSize)
              .Take(PageSize),
  
          PagingInfo = new PagingInfo{
              CurrentPage = page,
              ItemsPerPage = PageSize,
              TotalItems = category == null 
                  ? repository.Products.Count() 
                  : repository.Products.Where(p =&gt; p.Category == category).Count()
          },
  
          CurrentCategory = category
  };
  </code></pre>
  
  <p>An exception of type 'System.NullReferenceException' occurred in MyProject.DLL but was not handled in user code
  //here is the trace</p>