Add AreaCommitment area to MemberListWindow
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user