using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using SteUp.Shared.Core.Dto; namespace SteUp.Shared.Core.Entities; public class Scheda { [Key] public int Id { get; set; } public string? CodJfas { get; set; } [Required] public string CodMdep { get; set; } = string.Empty; public DateOnly Data { get; set; } [Required] public string Rilevatore { get; set; } = string.Empty; public Ispezione? Ispezione { get; set; } public string? DescrizioneReparto { get; set; } public string? ActivityTypeId { get; set; } public string? Note { get; set; } public string? Responsabile { get; set; } public int Scadenza { get; set; } = 24; [NotMapped] public JtbFasiDto? Reparto { get { if (_reparto == null && CodJfas != null) { _reparto = new JtbFasiDto { CodJfas = CodJfas, Descrizione = DescrizioneReparto }; } return _reparto; } set { _reparto = value; if (value == null) return; CodJfas = value.CodJfas; DescrizioneReparto = value.Descrizione; } } private JtbFasiDto? _reparto; }