shop info

This commit is contained in:
Tizian.Breuch
2025-08-12 11:07:15 +02:00
parent 0a43b1d7e8
commit 1692fe198e
13 changed files with 387 additions and 0 deletions

View File

@@ -0,0 +1,37 @@
// src/Webshop.Infrastructure/Repositories/ShopInfoRepository.cs
using Microsoft.EntityFrameworkCore;
using System.Threading.Tasks;
using Webshop.Domain.Entities;
using Webshop.Domain.Interfaces;
using Webshop.Infrastructure.Data;
namespace Webshop.Infrastructure.Repositories
{
public class ShopInfoRepository : IShopInfoRepository
{
private readonly ApplicationDbContext _context;
public ShopInfoRepository(ApplicationDbContext context)
{
_context = context;
}
public async Task<ShopInfo?> GetAsync()
{
// Es sollte immer nur eine Zeile geben, also nehmen wir die erste
return await _context.ShopInfos.FirstOrDefaultAsync();
}
public async Task UpdateAsync(ShopInfo shopInfo)
{
_context.ShopInfos.Update(shopInfo);
await _context.SaveChangesAsync();
}
public async Task AddAsync(ShopInfo shopInfo)
{
await _context.ShopInfos.AddAsync(shopInfo);
await _context.SaveChangesAsync();
}
}
}