using Microsoft.EntityFrameworkCore; using PowderCoating.Core.Entities; using PowderCoating.Core.Interfaces.Repositories; using PowderCoating.Infrastructure.Data; namespace PowderCoating.Infrastructure.Repositories; /// /// Typed repository for that adds domain-specific queries on top of /// the generic CRUD interface. /// public class CustomerRepository : Repository, ICustomerRepository { public CustomerRepository(ApplicationDbContext context) : base(context) { } /// public async Task LoadForDetailsAsync(int id) { return await _context.Customers .Where(c => c.Id == id && !c.IsDeleted) .Include(c => c.PricingTier) .Include(c => c.CustomerNotes.Where(n => !n.IsDeleted)) .FirstOrDefaultAsync(); } /// public async Task FindByEmailAsync(string email) { return await _context.Customers .FirstOrDefaultAsync(c => c.Email == email && !c.IsDeleted); } }