// src/Webshop.Infrastructure/Repositories/SupplierRepository.cs using Microsoft.EntityFrameworkCore; using Webshop.Domain.Entities; using Webshop.Domain.Interfaces; using Webshop.Infrastructure.Data; using System; using System.Collections.Generic; using System.Threading.Tasks; namespace Webshop.Infrastructure.Repositories { public class SupplierRepository : ISupplierRepository // MUSS public sein { private readonly ApplicationDbContext _context; public SupplierRepository(ApplicationDbContext context) { _context = context; } public async Task> GetAllSuppliersAsync() { return await _context.Suppliers.ToListAsync(); } public async Task GetSupplierByIdAsync(Guid id) { return await _context.Suppliers.FindAsync(id); } public async Task AddSupplierAsync(Supplier supplier) { _context.Suppliers.Add(supplier); await _context.SaveChangesAsync(); } public async Task UpdateSupplierAsync(Supplier supplier) { _context.Suppliers.Update(supplier); await _context.SaveChangesAsync(); } public async Task DeleteSupplierAsync(Guid id) { var supplier = await _context.Suppliers.FindAsync(id); if (supplier != null) { _context.Suppliers.Remove(supplier); await _context.SaveChangesAsync(); } } } }