54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using DAL.Models.Audits;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace DAL.Models
|
|
{
|
|
[Table("savedEvents")]
|
|
[Index("updater", Name = "savedEvents_users_id_fk")]
|
|
[Index("fgColorId", Name = "savedEvents_colors_id_fk")]
|
|
[Index("bgColorId", Name = "savedEvents_colors_id_fk_2")]
|
|
[Index("imageId", Name = "savedEvents_images_id_fk")]
|
|
public class SavedEvent : Model<SavedEvent, AuditSavedEvent>
|
|
{
|
|
[Column("name")]
|
|
[MaxLength(64)]
|
|
public string name { get; set; } = null!;
|
|
|
|
[Column("bgColorId")]
|
|
public ulong bgColorId { get; set; }
|
|
|
|
[Column("fgColorId")]
|
|
public ulong fgColorId { get; set; }
|
|
|
|
[Column("imageId")]
|
|
public ulong? imageId { get; set; }
|
|
|
|
public Color bgColorRelation { get; set; } = null!;
|
|
public Color fgColorRelation { get; set; } = null!;
|
|
public Image? imageRelation { get; set; }
|
|
|
|
public override AuditSavedEvent adaptToAudit()
|
|
{
|
|
return new AuditSavedEvent
|
|
{
|
|
id = id,
|
|
name = name,
|
|
bgColorId = bgColorId,
|
|
fgColorId = fgColorId,
|
|
imageId = imageId,
|
|
updated = updated,
|
|
updater = updater
|
|
};
|
|
}
|
|
public override void updateModel(ref SavedEvent dest)
|
|
{
|
|
dest.name = name;
|
|
dest.bgColorId = bgColorId;
|
|
dest.fgColorId = fgColorId;
|
|
dest.imageId = imageId;
|
|
}
|
|
}
|
|
}
|