Only show active contract area

This commit is contained in:
2023-04-16 23:27:27 +02:00
parent d049424615
commit d4e217efad
3 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,4 @@
using Elwig.Helpers;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
@ -144,6 +145,11 @@ namespace Elwig.Models {
[InverseProperty("Member")]
public virtual ISet<Contract> Contracts { get; private set; }
[NotMapped]
public virtual ISet<Contract> ActiveContracts => Contracts
.Where(c => c.YearFrom <= Utils.CurrentSeason && (c.YearTo ?? int.MaxValue) >= Utils.CurrentSeason)
.ToHashSet();
[InverseProperty("Member")]
public virtual BillingAddr BillingAddress { get; private set; }