This in my action method and I'm getting exception.
public ViewResult List(string category, int page = 1)
{
ProductsListViewModel model = new ProductsListViewModel {[enter image description here][1]
Products = repository.Products
.Where(p => category != null || p.Category == category)
.OrderBy(p => 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 => p.Category == category).Count()
},
CurrentCategory = category
};
An exception of type 'System.NullReferenceException' occurred in MyProject.DLL but was not handled in user code //here is the trace