66 lines
1.4 KiB
C#
66 lines
1.4 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>
|
|
/// Ressource Information
|
|
/// </summary>
|
|
public class Ressource
|
|
{
|
|
[BsonId]
|
|
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
|
|
public string Id { get; set; }
|
|
|
|
[BsonElement("Type")]
|
|
[BsonRequired]
|
|
public RessourceType Type { get; set; }
|
|
|
|
[BsonElement("Label")]
|
|
[BsonRequired]
|
|
public string Label { get; set; }
|
|
|
|
[BsonElement("DateCreation")]
|
|
public DateTime DateCreation { get; set; }
|
|
|
|
[BsonElement("Data")]
|
|
[BsonRequired]
|
|
public string Data { get; set; }
|
|
|
|
public RessourceDTO ToDTO()
|
|
{
|
|
return new RessourceDTO()
|
|
{
|
|
Id = Id,
|
|
Label = Label,
|
|
Type = Type
|
|
};
|
|
}
|
|
|
|
public RessourceDetailDTO ToDetailDTO()
|
|
{
|
|
return new RessourceDetailDTO()
|
|
{
|
|
Id = Id,
|
|
Label = Label,
|
|
Type = Type,
|
|
Data = Data,
|
|
DateCreation = DateCreation
|
|
};
|
|
}
|
|
|
|
}
|
|
|
|
public enum RessourceType
|
|
{
|
|
Image,
|
|
Video,
|
|
ImageUrl,
|
|
VideoUrl
|
|
}
|
|
}
|