45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
using ManagerService.DTOs;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
|
|
namespace ManagerService.Data.SubSection
|
|
{
|
|
/// <summary>
|
|
/// Ordered translationAndResource
|
|
/// </summary>
|
|
public class OrderedTranslationAndResource
|
|
{
|
|
[Key]
|
|
[Required]
|
|
public int Id { get; set; }
|
|
|
|
[Required]
|
|
[Column(TypeName = "jsonb")]
|
|
public List<TranslationAndResource> TranslationAndResources { get; set; }
|
|
|
|
public int Order { get; set; } // Order to show
|
|
|
|
|
|
public OrderedTranslationAndResourceDTO ToDTO()
|
|
{
|
|
return new OrderedTranslationAndResourceDTO()
|
|
{
|
|
translationAndResourceDTOs = TranslationAndResources.Select(tar => tar.ToDTO()).ToList(),
|
|
order = Order
|
|
};
|
|
}
|
|
|
|
public OrderedTranslationAndResource FromDTO(OrderedTranslationAndResourceDTO orderedTranslationAndResourceDTO)
|
|
{
|
|
return new OrderedTranslationAndResource()
|
|
{
|
|
TranslationAndResources = orderedTranslationAndResourceDTO.translationAndResourceDTOs.Select(tar => new TranslationAndResource().FromDTO(tar)).ToList(),
|
|
Order = orderedTranslationAndResourceDTO.order
|
|
};
|
|
}
|
|
}
|
|
}
|