Maybe a little late. You want to sort your records by ID, not filter them. To sort the records by Id, you can use 'LINQ' to sort the 'Model' before iterating through it in your foreach loop, assuming Id is a property of the objects in your 'Model' - Sorting Operators: OrderBy & OrderByDescending[^] Your code will look something like -
@foreach (var rec in Model.OrderBy(r => r.Id))
{
@rec.Date.ToString("dd-MM-yyyy hh:ss")
[@rec.MailSubject](@Url.Action\()
@rec.Nb
@rec.NomAlerte
@rec.Email
@rec.TypeAlerte
}