manager-service/ManagerService/Data/SubSection/TranslationAndResource.cs
Thomas Fransolet 0229793c88 MISC
2025-05-15 17:21:18 +02:00

48 lines
1.2 KiB
C#

using ManagerService.DTOs;
using System;
using System.ComponentModel.DataAnnotations;
namespace ManagerService.Data.SubSection
{
/// <summary>
/// Translation
/// </summary>
public class TranslationAndResource
{
[Key]
[Required]
public int Id { get; set; }
[Required]
public string Language { get; set; }
public string Value { get; set; }
public string ResourceId { get; set; }
public Resource? Resource { get; set; }
public TranslationAndResourceDTO ToDTO()
{
return new TranslationAndResourceDTO()
{
language = Language,
value = Value,
resourceId = ResourceId,
resource = Resource?.ToDTO()
};
}
public TranslationAndResource FromDTO(TranslationAndResourceDTO translationAndResourceDTO)
{
return new TranslationAndResource()
{
Language = translationAndResourceDTO.language,
Value = translationAndResourceDTO.value,
ResourceId = translationAndResourceDTO.resourceId
};
}
}
}