Add transaction list
This commit is contained in:
@@ -34,5 +34,19 @@ namespace InventoryTraker.Web.Controllers
|
||||
|
||||
return BetterJson(viewModels);
|
||||
}
|
||||
|
||||
public JsonResult GetTransactions(int pageNumber, int pageSize)
|
||||
{
|
||||
var viewModels =
|
||||
_context.Transactions
|
||||
.OrderByDescending(t => t.Timestamp)
|
||||
.Skip((pageNumber - 1) * pageSize)
|
||||
.Take(pageSize)
|
||||
.ProjectTo<TransactionViewModel>()
|
||||
.ToArray();
|
||||
|
||||
var count = _context.Transactions.Count();
|
||||
return BetterJson(new {totalItems = count, transactions = viewModels});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user