We are now ready to facilitate interaction between our model and database via our newly created repositories. After making the appropriate changes to ProductRepository, it will look like this:
using System.Collections.Generic; using System.Linq; using FlixOne.BookStore.ProductService.Contexts; using FlixOne.BookStore.ProductService.Models; namespace FlixOne.BookStore.ProductService.Persistence { public class ProductRepository : IProductRepository { private readonly ProductContext _context; public ProductRepository(ProductContext context) { _context = context; } public void Add(Product Product) { _context.Add(Product); _context.SaveChanges(); } public IEnumerable<Product> GetAll() { return _context.Products.ToList(); ...