I'm using a component called datatables.js ( link ) to display my tables and it has the ServerSide strong>, which I call, in Ajax, my list from somewhere. It sends the ordering, meaning by parameters. It sends the Index column to be sorted. My query looks like this:
var test1 = (from x in Context.MyTable
where (x.codigo_empresa == User.EnterpriseId
&& (filtro.DataInicial == DateTime.MinValue || x.Vencimento >= filtro.DataInicial)
&& (filtro.DataFinal == DateTime.MinValue || x.Vencimento <= filtro.DataFinal)
&& (filtro.Status == 0 || x.Status == filtro.Status))
select (new
{
Status = (EnumContas.Status)x.Status,
Vencimento = x.Vencimento ?? DateTime.MinValue,
Valor = x.Valor,
id = x.Id,
IdConta = x.IdConta
}));
I need to sort it according to the column index that comes by parameters (assuming my select is in the order in which the columns will be displayed).
Any ideas how to do this?