diff options
Diffstat (limited to 'CoreWiki/Models')
| -rw-r--r-- | CoreWiki/Models/ApplicationDbContext.cs | 14 | ||||
| -rw-r--r-- | CoreWiki/Models/Article.cs | 11 |
2 files changed, 25 insertions, 0 deletions
diff --git a/CoreWiki/Models/ApplicationDbContext.cs b/CoreWiki/Models/ApplicationDbContext.cs new file mode 100644 index 0000000..48b5dcf --- /dev/null +++ b/CoreWiki/Models/ApplicationDbContext.cs @@ -0,0 +1,14 @@ +using Microsoft.EntityFrameworkCore; + +namespace CoreWiki.Models; + +public class ApplicationDbContext : DbContext +{ + public DbSet<Article> Articles { get; set; } + + public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) + { + + } + +}
\ No newline at end of file diff --git a/CoreWiki/Models/Article.cs b/CoreWiki/Models/Article.cs new file mode 100644 index 0000000..c461758 --- /dev/null +++ b/CoreWiki/Models/Article.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace CoreWiki.Models; + +public class Article +{ + [Required, Key] + public string Topic { get; set; } + public DateTime Published { get; set; } = DateTime.UtcNow; + public string Content { get; set; } +}
\ No newline at end of file |
