1
我有一個pagedlist的問題。c#PagedList異步
我想更改選定的列但不工作。所以,我想使這個:
return db.stock_products.select(x=> new {x.id,x.title,x.etc}).AsExpandable().Where(classFilter).OrderByDescending(x => x.id).ToPagedList(pageNumber, pageSize);
代碼:
public async Task<IPagedList<DAL.stock_products>> GetPagedListAsync(int pageNumber = 1, int pageSize = 23)
{
try
{
return await Task.Factory.StartNew(() =>
{
if (isFiltered == false)
{
return db.stock_products.Where(x=>x.quantity>0).OrderByDescending(x => x.id).ToPagedList(pageNumber, pageSize);
}
isFiltered = false;
return db.stock_products.AsExpandable().Where(classFilter).OrderByDescending(x => x.id).ToPagedList(pageNumber, pageSize);
});
}
catch (Exception ex)
{
MessageBox.Show("Stop", "Hata", MessageBoxButtons.OK, MessageBoxIcon.Hand);
Application.Exit();
}
return null;
}