Update models because contracts were removed

This commit is contained in:
2023-05-01 22:17:50 +02:00
parent 54aaf9fda0
commit c8f0537976
9 changed files with 77 additions and 103 deletions

View File

@ -25,9 +25,7 @@ namespace Elwig.Helpers {
public DbSet<WbKg> WbKgs { get; set; }
public DbSet<WbRd> WbRde { get; set; }
public DbSet<AreaCom> AreaCommitments { get; set; }
public DbSet<AreaComParcel> AreaCommitmentParcels { get; set; }
public DbSet<AreaComAttr> AreaCommitmentAttributes { get; set; }
public DbSet<Contract> Contracts { get; set; }
public DbSet<WineOrigin> WineOrigins { get; set; }
public DbSet<WineAttr> WineAttributes { get; set; }
public DbSet<WineCult> WineCultivations { get; set; }
@ -75,8 +73,8 @@ namespace Elwig.Helpers {
return await Members.FindAsync(mgnr) != null;
}
public async Task<bool> VNrExists(int vnr) {
return await Contracts.FindAsync(vnr) != null;
public async Task<bool> FbNrExists(int fbnr) {
return await AreaCommitments.FindAsync(fbnr) != null;
}
public async Task<int> NextMgNr() {
@ -86,9 +84,9 @@ namespace Elwig.Helpers {
return c + 1;
}
public async Task<int> NextVNr() {
int c = await Contracts.Select(co => co.VNr).MinAsync();
(await Contracts.OrderBy(co => co.VNr).Select(co => co.VNr).ToListAsync())
public async Task<int> NextFbNr() {
int c = await AreaCommitments.Select(ac => ac.FbNr).MinAsync();
(await AreaCommitments.OrderBy(ac => ac.FbNr).Select(ac => ac.FbNr).ToListAsync())
.ForEach(a => { if (a <= c + 100) c = a; });
return c + 1;
}