AppDbContext: Add NextAvNr()

This commit is contained in:
2024-01-08 14:18:15 +01:00
parent d77aac43ec
commit 09a7889044

View File

@ -200,6 +200,13 @@ namespace Elwig.Helpers {
return c + 1; return c + 1;
} }
public async Task<int> NextAvNr(int year) {
int c = 0;
(await PaymentVariants.Where(v => v.Year == year).Select(v => v.AvNr).ToListAsync())
.ForEach(a => { if (a <= c + 100) c = a; });
return c + 1;
}
public async Task<WineQualLevel> GetWineQualityLevel(double kmw) { public async Task<WineQualLevel> GetWineQualityLevel(double kmw) {
return await WineQualityLevels return await WineQualityLevels
.Where(q => !q.IsPredicate && (q.MinKmw == null || q.MinKmw <= kmw)) .Where(q => !q.IsPredicate && (q.MinKmw == null || q.MinKmw <= kmw))