I have orders table with IdNumber
that is the ID of the user, I need to get the last order of each user (the InsuranceDate
is the date).
The problem is how to get the last order if one user can have many orders. how to do it with one query without huge foreach after the entity query ?
public class Order
{
[Key]
public int OrderID { get; set; }
public string IdNumber { get; set; }
public int Price { get; set; }
public Datetime InsuranceDate { get; set; }
}