24 lines
676 B
C#
24 lines
676 B
C#
using Microsoft.EntityFrameworkCore;
|
|
using WerksverkaufScanner.Data;
|
|
|
|
namespace WerksverkaufScanner.Services
|
|
{
|
|
public class FilialService
|
|
{
|
|
private readonly IDbContextFactory<ScannerDb> _dbFactory;
|
|
|
|
public FilialService(IDbContextFactory<ScannerDb> dbFactory)
|
|
{
|
|
_dbFactory = dbFactory;
|
|
}
|
|
|
|
public async Task<Filiale?> GetFilialeAsync(int filialId)
|
|
{
|
|
await using var db = await _dbFactory.CreateDbContextAsync();
|
|
return await db.Set<Filiale>()
|
|
.AsNoTracking()
|
|
.FirstOrDefaultAsync(f => f.FilialId == filialId);
|
|
}
|
|
}
|
|
}
|