2021-08-04 18:07:21 +02:00

62 lines
1.8 KiB
C#

using Manager.Interfaces.DTO;
using MongoDB.Bson.Serialization.Attributes;
using System;
using System.Collections.Generic;
using System.Text;
namespace Manager.Interfaces.Models
{
/// <summary>
/// Configuration Information
/// </summary>
public class Configuration
{
[BsonId]
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
public string Id { get; set; }
[BsonElement("Label")]
[BsonRequired]
public string Label { get; set; }
[BsonElement("PrimaryColor")]
public string PrimaryColor { get; set; }
[BsonElement("SecondaryColor")]
public string SecondaryColor { get; set; }
[BsonElement("Languages")]
public List<string> Languages { get; set; } // fr, en, de, nl => Sélection dans une liste déjà établie dans l'application !
[BsonElement("DateCreation")]
public DateTime DateCreation { get; set; }
public ConfigurationDTO ToDTO()
{
return new ConfigurationDTO()
{
id = Id,
label = Label,
dateCreation = DateCreation,
primaryColor = PrimaryColor,
languages = Languages,
secondaryColor = SecondaryColor
};
}
public ExportConfigurationDTO ToExportDTO(List<SectionDTO> sections, List<ResourceDTO> resources) {
return new ExportConfigurationDTO()
{
id = Id,
label = Label,
dateCreation = DateCreation,
primaryColor = PrimaryColor,
languages = Languages,
secondaryColor = SecondaryColor,
sections = sections,
resources = resources
};
}
}
}