using Core.Entities; using Core.Interfaces; using Microsoft.EntityFrameworkCore; namespace Infrastructure.Data { public class ProductRepository : iProductRepository { private readonly StoreContext _context; public ProductRepository(StoreContext context) { _context = context; } public async Task> GetProductBrandsAsync() { return await _context.ProductBrands.ToListAsync(); } public async Task GetProductByIdAsync(int id) { return await _context.Products .Include(p => p.ProductType) .Include(p => p.ProductBrand) .FirstOrDefaultAsync(p => p.Id == id); } public async Task> GetProductsAync() { return await _context.Products .Include(p => p.ProductType) .Include(p => p.ProductBrand) .ToListAsync(); } public async Task> GetProductTypesAsync() { return await _context.ProductTypes.ToListAsync(); } } }