Utils: Add ActiveAreaCommitments()

This commit is contained in:
2024-03-25 16:22:58 +01:00
parent c6e83ffff4
commit 3f9c4cb1f6
5 changed files with 15 additions and 6 deletions

View File

@ -156,9 +156,8 @@ namespace Elwig.Models.Entities {
[InverseProperty(nameof(AreaCom.Member))]
public virtual ICollection<AreaCom> AreaCommitments { get; private set; } = null!;
public IEnumerable<AreaCom> ActiveAreaCommitments(AppDbContext ctx) {
return ctx.AreaCommitments
.Where(c => c.MgNr == MgNr && c.YearFrom <= Utils.CurrentYear && (c.YearTo ?? int.MaxValue) >= Utils.CurrentYear);
public IQueryable<AreaCom> ActiveAreaCommitments(AppDbContext ctx) {
return Utils.ActiveAreaCommitments(ctx.AreaCommitments.Where(c => c.MgNr == MgNr));
}
[InverseProperty(nameof(BillingAddr.Member))]