How to sort a table for a second field in case the 1st field is repeated? in MVC of Asp.Net and VisualStudio2017

0

I am using Visual Studio 2017 with ASP.Net and MVC . Where I am sorting the fields of a table by a field Call number .

public ActionResult Index(){
    var hojaArchivo = db.HojaArchivo.Include(h => h.HojaInicial).Include(h => h.Materia);
    return View(hojaArchivo.OrderBy(e=> e.HojaInicial.NumeroConvocatoria ));
}

Where I used the following code in the controller and I could sort by the CallNumber field and it went very well, the question is how to order in a second field in case the first boss is the same.

The intention is to sort the numbers in the Point field if there are repeated fields in the Call Number field.

Try to do it using a comma , but it gives me an error.

I have searched the Microsoft documentation but only order by a field in:

  

Sorting, Filtering, and Paging with the Entity Framework in an ASP.NET MVC Application

Please, if you have an idea, I will be grateful.

    
asked by gorkyvtn 04.07.2018 в 18:23
source

1 answer

0
return View(hojaArchivo.OrderBy(e=> e.HojaInicial.NumeroConvocatoria ).ThenBy(e=>e.ElOtroParametro))

I hope it helps you

    
answered by 04.07.2018 / 18:35
source