using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace LCU.Library.Internal.LoanRateModels.Entities; public class Rate { public int RateId { get; set; } public int? RateUploadInfoId { get; set; } public int? ClosingRateUploadInfoId { get; set; } public string Column { get; set; } public string Row { get; set; } public int RateSheetId { get; set; } public decimal Value { get; set; } [Required] [Range(typeof(DateTime), "1/2/0001", "12/30/9999", ErrorMessage = "Value for {0} must be between {1} and {2}")] public DateTime RateStartDate { get; set; } public DateTime? RateEndDate { get; set; } [ForeignKey("RateId")] public ICollection RateEvaluations { get; set; } public Rate DeepCopyNewRate() { Rate newRate = (Rate)this.MemberwiseClone(); newRate.RateId = 0; newRate.RateEvaluations = new List(); foreach (var rateRule in RateEvaluations) { var newRateRule = (RateEvaluation)rateRule.ShallowCopyNewRate(); newRate.RateEvaluations.Add(newRateRule); } return newRate; } }