This commit is contained in:
Tizian.Breuch
2025-08-01 15:11:42 +02:00
parent 96f082b38f
commit 55eeaca7f4
29 changed files with 452 additions and 452 deletions

View File

@@ -1,4 +1,4 @@
// src/Webshop.Infrastructure/Repositories/CategoryRepository.cs
// src/Webshop.Infrastructure/Repositories/categorieRepository.cs
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
@@ -9,48 +9,48 @@ using Webshop.Infrastructure.Data;
namespace Webshop.Infrastructure.Repositories
{
public class CategoryRepository : ICategoryRepository
public class categorieRepository : IcategorieRepository
{
private readonly ApplicationDbContext _context;
public CategoryRepository(ApplicationDbContext context)
public categorieRepository(ApplicationDbContext context)
{
_context = context;
}
public async Task<IEnumerable<Category>> GetAllAsync()
public async Task<IEnumerable<categorie>> GetAllAsync()
{
return await _context.categorys.ToListAsync();
return await _context.categories.ToListAsync();
}
public async Task<Category?> GetByIdAsync(Guid id)
public async Task<categorie?> GetByIdAsync(Guid id)
{
return await _context.categorys.FindAsync(id);
return await _context.categories.FindAsync(id);
}
public async Task<Category?> GetBySlugAsync(string slug)
public async Task<categorie?> GetBySlugAsync(string slug)
{
return await _context.categorys.FirstOrDefaultAsync(c => c.Slug == slug);
return await _context.categories.FirstOrDefaultAsync(c => c.Slug == slug);
}
public async Task AddAsync(Category category)
public async Task AddAsync(categorie categorie)
{
_context.categorys.Add(category);
_context.categories.Add(categorie);
await _context.SaveChangesAsync();
}
public async Task UpdateAsync(Category category)
public async Task UpdateAsync(categorie categorie)
{
_context.categorys.Update(category);
_context.categories.Update(categorie);
await _context.SaveChangesAsync();
}
public async Task DeleteAsync(Guid id)
{
var category = await _context.categorys.FindAsync(id);
if (category != null)
var categorie = await _context.categories.FindAsync(id);
if (categorie != null)
{
_context.categorys.Remove(category);
_context.categories.Remove(categorie);
await _context.SaveChangesAsync();
}
}