56 lines
1.4 KiB
C#
56 lines
1.4 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace back.DataModels;
|
|
|
|
[Table("Events")]
|
|
public class EventModel
|
|
{
|
|
[Key]
|
|
public string Id { get; set; }
|
|
[Required, MaxLength(50)]
|
|
public string? Title { get; set; }
|
|
[MaxLength(500)]
|
|
public string? Description { get; set; }
|
|
public DateTime? Date { get; set; }
|
|
public string? Location { get; set; }
|
|
[ForeignKey("TagId")]
|
|
public List<TagModel> RelatedTags { get; set; } = [];
|
|
public DateTime CreatedAt { get; set; }
|
|
public DateTime UpdatedAt { get; set; }
|
|
public string? CreatedBy { get; set; }
|
|
public string? UpdatedBy { get; set; }
|
|
|
|
public EventModel() { }
|
|
|
|
public EventModel(string id)
|
|
{
|
|
Id = id;
|
|
}
|
|
|
|
public EventModel(
|
|
string id,
|
|
string title,
|
|
string description,
|
|
DateTime date,
|
|
string location,
|
|
List<TagModel>? relatedTags = null,
|
|
DateTime? createdAt = null,
|
|
DateTime? updatedAt = null,
|
|
string? createdBy = null,
|
|
string? updatedBy = null)
|
|
{
|
|
Id = id;
|
|
Title = title;
|
|
Description = description;
|
|
Date = date;
|
|
Location = location;
|
|
RelatedTags = relatedTags ?? [];
|
|
CreatedAt = createdAt ?? DateTime.UtcNow;
|
|
UpdatedAt = updatedAt ?? DateTime.UtcNow;
|
|
CreatedBy = createdBy ?? "";
|
|
UpdatedBy = updatedBy;
|
|
}
|
|
}
|
|
|