blob: b9895736346d92c9e64341a0bce64e0507dc10c4 (
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
25
26
27
28
29
30
31
32
33
|
using NodaTime;
using NodaTime.Extensions;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using CoreWiki.Utils;
namespace CoreWiki.Models;
public class Article
{
[Key]
public string Slug { get; set; }
[Required, MaxLength(100)]
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")]
[Required]
public DateTime PublishedDateTime
{
get => Published.ToDateTimeUtc();
set => Published = DateTime.SpecifyKind(value, DateTimeKind.Utc).ToInstant();
}
[DataType(DataType.MultilineText)]
[Required]
public string Content { get; set; } = default!;
}
|