public ModelToModel GetAll() { ModelToModel mm; mm = new ModelToModel(); mm.books = new List<Book>(); using (BookMarketDbContext db = new BookMarketDbContext()) { foreach (Book entry in db.GetAllBooks()) { mm.books.Add(entry); } } return mm; }