Models: Small payment fixes

This commit is contained in:
2023-09-07 16:54:33 +02:00
parent 47e8ab7e62
commit 2de4739e9d
3 changed files with 25 additions and 7 deletions

View File

@ -2,7 +2,7 @@ using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
namespace Elwig.Models {
[Table("payment_member"), PrimaryKey("Year", "AvNr", "MgNr")]
[Table("payment_member"), PrimaryKey("Year", "AvNr", "MgNr"), Index("Year", "TgNr", IsUnique = true)]
public class PaymentMember {
[Column("year")]
public int Year { get; set; }
@ -16,6 +16,9 @@ namespace Elwig.Models {
[Column("amount")]
public long AmountValue { get; set; }
[Column("tgnr")]
public int? TgNr { get; set; }
[NotMapped]
public decimal Amount {
get => Variant.Season.DecFromDb(AmountValue);