55 lines
1.2 KiB
C#
55 lines
1.2 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>
|
|
/// Resource Information
|
|
/// </summary>
|
|
public class Resource
|
|
{
|
|
[BsonId]
|
|
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
|
|
public string Id { get; set; }
|
|
|
|
[BsonElement("Type")]
|
|
[BsonRequired]
|
|
public ResourceType 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 ResourceDTO ToDTO(bool isExport = false)
|
|
{
|
|
return new ResourceDTO()
|
|
{
|
|
id = Id,
|
|
label = Label,
|
|
type = Type,
|
|
data = isExport ? Data : null,
|
|
dateCreation = DateCreation
|
|
};
|
|
}
|
|
}
|
|
|
|
public enum ResourceType
|
|
{
|
|
Image,
|
|
Video,
|
|
ImageUrl,
|
|
VideoUrl
|
|
}
|
|
}
|