naming
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user