Use integer as penalty_amount

This commit is contained in:
2023-08-24 18:11:13 +02:00
parent 83a82c17c6
commit 5dd56d9666
4 changed files with 8 additions and 7 deletions

View File

@ -1,3 +1,4 @@
using Elwig.Helpers;
using Microsoft.EntityFrameworkCore;
using System.ComponentModel.DataAnnotations.Schema;
@ -26,12 +27,12 @@ namespace Elwig.Models {
public int? MaxKgPerHa { get; set; }
[Column("penalty_amount")]
public double? PenaltyAmoutValue { get; set; }
public long? PenaltyAmoutValue { get; set; }
[NotMapped]
public decimal? PenaltyAmount {
get => PenaltyAmoutValue != null ? (decimal)PenaltyAmoutValue : null;
set => PenaltyAmoutValue = value != null ? (double)value : null;
get => PenaltyAmoutValue != null ? Utils.DecFromDb(PenaltyAmoutValue.Value, 4) : null;
set => PenaltyAmoutValue = value != null ? Utils.DecToDb(value.Value, 4) : null;
}
[ForeignKey("SortId")]