57 lines
1.3 KiB
C#
57 lines
1.3 KiB
C#
using Manager.DTOs;
|
|
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>
|
|
/// Categorie
|
|
/// </summary>
|
|
public class Categorie
|
|
{
|
|
[Key]
|
|
[Required]
|
|
public int Id { get; set; }
|
|
|
|
[Required]
|
|
[Column(TypeName = "jsonb")]
|
|
public List<Translation> Label { get; set; }
|
|
|
|
public string Icon { get; set; } // icon material
|
|
|
|
public string ResourceId { get; set; }
|
|
|
|
public Resource Resource { get; set; } // icon
|
|
|
|
public int? Order { get; set; } // Order to show
|
|
|
|
|
|
public CategorieDTO ToDTO()
|
|
{
|
|
return new CategorieDTO()
|
|
{
|
|
id = Id,
|
|
label = Label.OrderBy(l => l.Language).Select(l => l.ToDTO()).ToList(),
|
|
icon = Icon,
|
|
order = Order,
|
|
resourceDTO = Resource.ToDTO()
|
|
};
|
|
}
|
|
|
|
public Categorie FromDTO(CategorieDTO categorieDTO)
|
|
{
|
|
return new Categorie()
|
|
{
|
|
Id = categorieDTO.id,
|
|
// TODO
|
|
/*Label = categorieDTO.label,
|
|
*/
|
|
};
|
|
}
|
|
}
|
|
}
|