summaryrefslogtreecommitdiff
path: root/Models
diff options
context:
space:
mode:
Diffstat (limited to 'Models')
-rw-r--r--Models/Book.cs10
-rw-r--r--Models/LibraryContext.cs10
2 files changed, 20 insertions, 0 deletions
diff --git a/Models/Book.cs b/Models/Book.cs
new file mode 100644
index 0000000..998a3ee
--- /dev/null
+++ b/Models/Book.cs
@@ -0,0 +1,10 @@
+namespace LibraryAPI.Models {
+ public class Book {
+ public long Id { get; set; }
+ public DateTime PublicationDate { get; set; }
+
+ public string[] Genres { get; set; }
+ public int Edition { get; set; }
+ public string ISBN { get; set; }
+ }
+} \ No newline at end of file
diff --git a/Models/LibraryContext.cs b/Models/LibraryContext.cs
new file mode 100644
index 0000000..114ce2c
--- /dev/null
+++ b/Models/LibraryContext.cs
@@ -0,0 +1,10 @@
+using Microsoft.EntityFrameworkCore;
+
+namespace LibraryAPI.Models {
+ public class LibraryContext : DbContext {
+ public DbSet<Book>? Books { get; set; }
+ public LibraryContext(DbContextOptions<LibraryContext> options) : base(options) {}
+ //protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ // => optionsBuilder.UseNpgsql("Host=127.0.0.1;Database=library;Username=luis");
+ }
+} \ No newline at end of file