I need help writing a C# Function using LINQ that will return me the ID of the last record from a table named Books in an SQL Server Database named MyLibrary.
I have named DbContext in my application MyLibraryDbContext.
I am using Entity Framework 6 (LINQ to Entities). The data is already in my application and can be retrieved using MyLibraryDbContext.
The function I need will look like something as below:
public int GetIdOfLastRecord()
MyLibraryDbContext context = new MyLibraryDbContext();
// Code here
Thank you for your help.