ASP.NET MVC using Repository pattern
I have a very good solution for you. See the below two blog posts:


  Generic Repository Pattern - Entity Framework, ASP.NET MVC and Unit
  Testing Triangle
  
  How to Work With Generic Repositories on ASP.NET MVC and Unit Testing
  Them By Mocking


What I can suggest more is this:

Implementing IDisposable:

Implement IDisposable on your repository and dispose them on your controller by overriding the Controller.Dispose method. Sample:

IContactRepository:

public interface IContactRepository : IDisposable {

    //same as above
}


Add the below code to your ContactRepository class:

private bool disposed = false;

protected virtual void Dispose(bool disposing) {

    if (!this.disposed)
        if (disposing)
            addressBookdb.Dispose();

    this.disposed = true;
}

public void Dispose() {

    Dispose(true);
    GC.SuppressFinalize(this);
}


On your controller, add this code:

protected override void Dispose(bool disposing) {

    contactRepository.Dispose();

    base.Dispose(disposing);
}