How do I get the max ID with Linq to Entity?
try this
int intIdt = db.Users.Max(u => u.UserId);
Update:
If no record then generate exception using above code try this
int? intIdt = db.Users.Max(u => (int?)u.UserId);
Do that like this
db.Users.OrderByDescending(u => u.UserId).FirstOrDefault();