From 00c3b32e2db200a2f42396ac7f8381704ec97268 Mon Sep 17 00:00:00 2001 From: Paweł Bernaciak Date: Fri, 10 Feb 2023 16:19:46 +0100 Subject: Initial Commit --- CoreWiki/Models/ApplicationDbContext.cs | 14 ++++++++++++++ CoreWiki/Models/Article.cs | 11 +++++++++++ 2 files changed, 25 insertions(+) create mode 100644 CoreWiki/Models/ApplicationDbContext.cs create mode 100644 CoreWiki/Models/Article.cs (limited to 'CoreWiki/Models') 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
Articles { get; set; } + + public ApplicationDbContext(DbContextOptions 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 -- cgit v1.2.3