I would suggest you to use the ToDataSourceResult extension method and send DataSourceRequest to the server. The DataSourceRequest object is holding information about the sorting, filtering, grouping and paging.
You will need to set type to the dataSource as follows:
You will also need to configure Schema in order to read the response. Below is an example of view, where server grouping and sorting are enabled.
.DataSource(source => source
.Sort(s => s.Add("Name"))
.Group(g => g.Add("TypeP", typeof(string)))
.Transport(transport => transport
.Schema(s => s
.Model( m => m.Id("Id"))
Than in the controller, you will need to handle the request.
JsonResult GetProducts([DataSourceRequest]DataSourceRequest request)
var productss = ProductsAll().ToDataSourceResult(request);
Attached you will find a sample .Net Core project where the grouping and sorting are implemented in the described way.