Models: Add Entities/ folder

This commit is contained in:
2023-11-10 13:48:25 +01:00
parent 2f98df87a0
commit 32f229b0a5
63 changed files with 63 additions and 68 deletions

View File

@ -0,0 +1,57 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
namespace Elwig.Models.Entities {
[Table("payment_variant"), PrimaryKey("Year", "AvNr")]
public class PaymentVar {
[Column("year")]
public int Year { get; set; }
[Column("avnr")]
public int AvNr { get; set; }
[Column("name")]
public string Name { get; set; }
[Column("date")]
public string DateString { get; set; }
[NotMapped]
public DateOnly Date {
get => DateOnly.ParseExact(DateString, "yyyy-MM-dd");
set => DateString = value.ToString("yyyy-MM-dd");
}
[Column("transfer_date")]
public string? TransferDateString { get; set; }
[NotMapped]
public DateOnly? TransferDate {
get => TransferDateString != null ? DateOnly.ParseExact(TransferDateString, "yyyy-MM-dd") : null;
set => TransferDateString = value?.ToString("yyyy-MM-dd");
}
[Column("test_variant")]
public bool TestVariant { get; set; }
[Column("calc_time")]
public int? CalcTime { get; set; }
[Column("comment")]
public string? Comment { get; set; }
[Column("data")]
public string Data { get; set; }
[ForeignKey("Year")]
public virtual Season Season { get; private set; }
[InverseProperty("Variant")]
public virtual ISet<PaymentMember> MemberPayments { get; private set; }
[InverseProperty("Variant")]
public virtual ISet<Credit> Credits { get; private set; }
}
}