summaryrefslogtreecommitdiff
path: root/Models
diff options
context:
space:
mode:
authorHombreLaser <sebastian-440@live.com>2022-09-15 16:52:16 -0500
committerHombreLaser <sebastian-440@live.com>2022-09-15 16:52:16 -0500
commit0bcbc7f4721830a1a65fbd2e30fbb69f803884c2 (patch)
treef1fb8bb0c51ea7851f57731a95a05b74d7f2bbc8 /Models
parent2ef25a3fad449f8a05491db4a46fc3990c27cf15 (diff)
Añadir base de datos
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