ASP.NET / ASP.NET E-commerce Website Using Vue / DAL / DAO / ProductDAO.cs
ProductDAO.cs
Raw
using Casestudy.DAL.DomainClasses;
using Microsoft.EntityFrameworkCore;
namespace Casestudy.DAL.DAO
{
    public class ProductDAO
    {
        private readonly AppDbContext _db;
        public ProductDAO(AppDbContext ctx)
        {
            _db = ctx;
        }

        public async Task<List<Product>> GetAllByBrand(int id)
        {
            return await _db.Products!.Where(item => item.Brand!.Id == id).ToListAsync();
        }
    }
}