using Microsoft.EntityFrameworkCore; using Webshop.Domain.Entities; using Webshop.Domain.Interfaces; using Webshop.Infrastructure.Data; using System; using System.Threading.Tasks; namespace Webshop.Infrastructure.Repositories { public class CustomerRepository : ICustomerRepository { private readonly ApplicationDbContext _context; public CustomerRepository(ApplicationDbContext context) { _context = context; } public async Task GetByUserIdAsync(string userId) { return await _context.Customers.FirstOrDefaultAsync(c => c.AspNetUserId == userId); } public async Task UpdateAsync(Customer customer) { _context.Customers.Update(customer); await _context.SaveChangesAsync(); } } }