Saving delivery now works

This commit is contained in:
2023-07-31 15:42:46 +02:00
parent d06ea4f045
commit a62fb9ab16
4 changed files with 162 additions and 6 deletions

View File

@ -122,6 +122,14 @@ namespace Elwig.Helpers {
return c + 1;
}
public async Task<int> NextDId(int year) {
return await Deliveries.Where(d => d.Year == year).Select(d => d.DId).MaxAsync() + 1;
}
public async Task<int> NextDPNr(int year, int did) {
return await DeliveryParts.Where(p => p.Year == year && p.DId == did).Select(d => d.DPNr).MaxAsync() + 1;
}
public async Task<WineQualLevel> GetWineQualityLevel(double kmw) {
return await WineQualityLevels
.Where(q => !q.IsPredicate && (q.MinKmw == null || q.MinKmw <= kmw))