This commit is contained in:
RodoIsAlnum
2025-10-28 20:05:19 -06:00
parent aac701d2ce
commit fef5ca6aa6
22 changed files with 2868 additions and 334 deletions

View File

@@ -1,14 +0,0 @@
using Microsoft.EntityFrameworkCore;
using BibliotecaAPI.Models;
namespace BibliotecaAPI.Data
{
public class BibliotecaContext : DbContext
{
public BibliotecaContext(DbContextOptions<BibliotecaContext> options) : base(options) { }
public DbSet<Libro> Libros { get; set; }
public DbSet<Usuario> Usuarios { get; set; }
public DbSet<Prestamo> Prestamos { get; set; }
}
}

View File

@@ -5,12 +5,14 @@ namespace BibliotecaAPI.Models
public class Libro
{
[Key]
public int Id { get; set; }
public int IdLibro { get; set; }
public string Titulo { get; set; } = string.Empty;
public string Autor { get; set; } = string.Empty;
public string ISBN { get; set; } = string.Empty;
public int Año { get; set; }
public int Ano { get; set; }
public string Categoria { get; set; } = string.Empty;
public int CopiasDisponibles { get; set; }
public ICollection<Prestamo> Prestamos {get;set;}
}
}

View File

@@ -6,6 +6,7 @@ namespace BibliotecaAPI.Models
{
public class Prestamo
{
/*
[Key]
public int Id { get; set; }
@@ -19,6 +20,14 @@ namespace BibliotecaAPI.Models
public DateTime FechaPrestamo { get; set; } = DateTime.Now;
public DateTime? FechaDevolucion { get; set; }
public bool Devuelto { get; set; } = false;
public bool Devuelto { get; set; } = false;*/
public int IdPrestamo { get; set; }
public int IdUsuario { get; set; }
public int IdLibro { get; set; }
public DateTime FechaPrestamo { get; set; }
public bool Devuelto {get;set;}
public Usuario Usuario { get; set; }
public Libro Libro { get; set; }
}
}

View File

@@ -5,8 +5,11 @@ namespace BibliotecaAPI.Models
public class Usuario
{
[Key]
public int Id { get; set; }
public int IdUsuario { get; set; }
public string Nombre { get; set; } = string.Empty;
public string Email { get; set; } = string.Empty;
public string Apellido { get; set; } = string.Empty;
public DateTime FechaRegistro { get; set; }
public ICollection<Prestamo> Prestamos {get;set;}
}
}