94 lines
2.4 KiB
C#
94 lines
2.4 KiB
C#
using Manager.Interfaces.DTO;
|
|
using MongoDB.Bson.Serialization.Attributes;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
|
|
namespace Manager.Interfaces.Models
|
|
{
|
|
/// <summary>
|
|
/// Section Information
|
|
/// </summary>
|
|
public class Section
|
|
{
|
|
[BsonId]
|
|
[BsonRepresentation(MongoDB.Bson.BsonType.ObjectId)]
|
|
public string Id { get; set; }
|
|
|
|
[BsonElement("Label")]
|
|
[BsonRequired]
|
|
public string Label { get; set; } // Use in manager
|
|
|
|
[BsonElement("Title")]
|
|
[BsonRequired]
|
|
public List<TranslationDTO> Title { get; set; }
|
|
|
|
[BsonElement("Description")]
|
|
public List<TranslationDTO> Description { get; set; }
|
|
|
|
[BsonElement("Order")]
|
|
public int Order { get; set; }
|
|
|
|
[BsonElement("ConfigurationId")]
|
|
[BsonRequired]
|
|
public string ConfigurationId { get; set; } // Parent id
|
|
|
|
[BsonElement("ImageId")]
|
|
[BsonRequired]
|
|
public string ImageId { get; set; }
|
|
|
|
[BsonElement("ImageSource")]
|
|
[BsonRequired]
|
|
public string ImageSource { get; set; }
|
|
|
|
[BsonElement("Type")]
|
|
[BsonRequired]
|
|
public SectionType Type { get; set; }
|
|
|
|
[BsonElement("IsSubSection")]
|
|
[BsonRequired]
|
|
public bool IsSubSection { get; set; }
|
|
|
|
[BsonElement("ParentId")]
|
|
public string ParentId { get; set; } // only if it's an subsection
|
|
|
|
[BsonElement("DateCreation")]
|
|
public DateTime DateCreation { get; set; }
|
|
|
|
[BsonElement("Data")]
|
|
[BsonRequired]
|
|
public string Data { get; set; } // Json encapsulated section info
|
|
|
|
public SectionDTO ToDTO()
|
|
{
|
|
return new SectionDTO()
|
|
{
|
|
Id = Id,
|
|
Label = Label,
|
|
Title = Title.OrderBy(t => t.Language).ToList(),
|
|
Description = Description.OrderBy(d => d.Language).ToList(),
|
|
Order = Order,
|
|
Type = Type,
|
|
ImageId = ImageId,
|
|
ImageSource = ImageSource,
|
|
ConfigurationId = ConfigurationId,
|
|
IsSubSection = IsSubSection,
|
|
ParentId = ParentId,
|
|
Data = Data,
|
|
DateCreation = DateCreation
|
|
};
|
|
}
|
|
}
|
|
|
|
public enum SectionType
|
|
{
|
|
Map,
|
|
Slider,
|
|
Video,
|
|
Web,
|
|
Menu
|
|
}
|
|
}
|