Add AreaCommitment area to MemberListWindow

This commit is contained in:
2023-03-14 14:08:23 +01:00
parent 3614445cff
commit 0d8f62f404
9 changed files with 48 additions and 27 deletions

View File

@ -1,11 +1,13 @@
using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace WGneu.Models {
[Table("contract"), PrimaryKey("Vnr")]
[Table("contract"), PrimaryKey("VNr")]
public class Contract {
[Column("vnr")]
public int Vnr { get; set; }
public int VNr { get; set; }
[Column("mgnr")]
public int MgNr { get; set; }
@ -17,6 +19,12 @@ namespace WGneu.Models {
public int? YearTo { get; set; }
[ForeignKey("MgNr")]
public virtual Member Member { get; set; }
public virtual Member Member { get; private set; }
[InverseProperty("Contract")]
public virtual ISet<AreaCommitment> AreaCommitments { get; private set; }
[NotMapped]
public int Area => AreaCommitments.Select(a => a.Area).Sum();
}
}