summaryrefslogtreecommitdiff
path: root/CoreWiki/Models/Article.cs
blob: 53c27066f21cc8c6d6e9fe2d3b65fdac423e7765 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using NodaTime;
using NodaTime.Extensions;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace CoreWiki.Models;

public class Article
{
    [Required, Key]
    public string Topic { get; set; }
    [NotMapped]
    public Instant Published { get; set; } = SystemClock.Instance.GetCurrentInstant();
    [Obsolete("This property is only for serialization")]
    [DataType(DataType.DateTime)]
    [Column("Published")]
    public DateTime PublishedDateTime
    {
        get => Published.ToDateTimeUtc();
        set => Published = DateTime.SpecifyKind(value, DateTimeKind.Utc).ToInstant();
    }
    [DataType(DataType.MultilineText)]
    public string Content { get; set; }
}