48 lines
1.2 KiB
C#
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
|
|
};
|
|
}
|
|
}
|
|
}
|