0 Comments
We need to see how code displays in the blog:

Here we go with C# from VS2015
public class PagerGridItemsProcessor<T> : IGridItemsProcessor<Twhere T : class
{
    private readonly IGridPager _pager;
 
    public PagerGridItemsProcessor(IGridPager pager)
    {
        _pager = pager;
    }
 
    #region IGridItemsProcessor<T> Members
 
    public IQueryable<T> Process(IQueryable<T> items)
    {
        _pager.Initialize(items); //init pager
 
        if (_pager.CurrentPage <= 0) return items; //incorrect page
 
        int skip = (_pager.CurrentPage - 1)*_pager.PageSize;
        return items.Skip(skip).Take(_pager.PageSize);
    }
 
    #endregion
}


Here's some powershell from the ISE


$url = "http://localhost/ServerMetadataSystem/API/HostSystems"

$jsonTemplate = @"
{
"HostSystemName" : "",
"HostSystemDesc": ""
}
"@

$hs = $jsonTemplate | ConvertFrom-Json

21..40  | ForEach-Object {
$hs.HostSystemName = "Host" + $_
$hs.HostSystemDesc = "Host System " + $_

$json = $hs | ConvertTo-Json
$json
Invoke-WebRequest -Uri  $url -Method Post -Body $json -ContentType "application/json"
}

What about VSCode?

$url = "http://localhost/ServerMetadataSystem/API/HostSystems"

$jsonTemplate = @"
{
"HostSystemName" : "",
"HostSystemDesc": ""
}
"@

$hs = $jsonTemplate | ConvertFrom-Json

21..40  | ForEach-Object {
$hs.HostSystemName = "Host" + $_
$hs.HostSystemDesc = "Host System " + $_

$json = $hs | ConvertTo-Json
$json
Invoke-WebRequest -Uri  $url -Method Post -Body $json -ContentType "application/json"
}