You can use Repository pattern with it.Please read below articles for more info.
What is Repository pattern ?
Repository pattern:
In simple terms, a repository basically works as a mediator between our business logic layer and our data access layer of the application. Sometimes, it would be troublesome to expose the data access mechanism directly to business logic layer, it may result in redundant code for accessing data for similar entities or it may result in a code that is hard to test or understand. To overcome these kinds of issues, and to write an Interface driven and test driven code to access data, we use Repository Pattern. The repository makes queries to the data source for the data, thereafter maps the data from the data source to a business entity/domain object, finally and persists the changes in the business entity to the data source. According to MSDN, a repository separates the business logic from the interactions with the underlying data source or Web service. The separation between the data and business tiers has three benefits:
1.It centralizes the data logic or Web service access logic.
2.It provides a substitution point for the unit tests.
3.It provides a flexible architecture that can be adapted as the overall design of the application evolves.
CRUD Operations Using the Repository Pattern in MVC[^]
Learning MVC Part 6: Generic Repository Pattern in MVC3 Application with Entity Framework[^]
UPDATE
Instantiate your repo object inside the controller's constructor is as below.
private IBookRepository _bookRepository;
public BookController()
{
this._bookRepository = new BookRepository(new BookContext());
}
After that use it inside your action method is as below.
public ActionResult Index()
{
var books = from book in _bookRepository.GetBooks()
select book;
return View(books);
}
NOTE: Please read 1st link for more info. :)