Получите последний удостоверение личности EF
//Grab the highest value using the Max() method
int max = db.Products.Max(p => p.ID);
Agreeable Armadillo
//Grab the highest value using the Max() method
int max = db.Products.Max(p => p.ID);
//Grab the highest ID value using the OrderByDescending() method
var max = db.Products.OrderByDescending(p => p.ID).FirstOrDefault().ID;