diff options
author | HombreLaser <sebastian-440@live.com> | 2022-11-22 16:46:46 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2022-11-22 16:46:46 -0600 |
commit | 214cd4db690635ba2a30183c1679c3e4d7b8e896 (patch) | |
tree | 95de21f42a07c27cdfa5b50be25ae97bab3abefe /Models | |
parent | ea20e100d4afe4429ab4c24926bffc0a8f9b9b70 (diff) |
Añadido modelo de ticket
Diffstat (limited to 'Models')
-rw-r--r-- | Models/ApplicationDbContext.cs | 1 | ||||
-rw-r--r-- | Models/Raffle.cs | 1 | ||||
-rw-r--r-- | Models/Ticket.cs | 17 | ||||
-rw-r--r-- | Models/UserAccount.cs | 1 |
4 files changed, 20 insertions, 0 deletions
diff --git a/Models/ApplicationDbContext.cs b/Models/ApplicationDbContext.cs index 07907c7..80eb64e 100644 --- a/Models/ApplicationDbContext.cs +++ b/Models/ApplicationDbContext.cs @@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore; namespace BackendPIA.Models { public class ApplicationDbContext : IdentityDbContext<UserAccount> { public DbSet<Raffle>? Raffles { get; set; } + public DbSet<Ticket>? Tickets { get; set; } public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : base(options) {} diff --git a/Models/Raffle.cs b/Models/Raffle.cs index 6e2640d..ebd8e8b 100644 --- a/Models/Raffle.cs +++ b/Models/Raffle.cs @@ -10,5 +10,6 @@ namespace BackendPIA.Models { [Range(1, 54, ErrorMessage = "Value for {0} must be between {1} and {2}.")] public int Winners { get; set; } public bool IsClosed { get; set; } + public ICollection<Ticket>? Tickets { get; set; } } }
\ No newline at end of file diff --git a/Models/Ticket.cs b/Models/Ticket.cs new file mode 100644 index 0000000..e459027 --- /dev/null +++ b/Models/Ticket.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; + +namespace BackendPIA.Models { + public class Ticket { + public long Id { get; set; } + [Required] + [Range(1, 54, ErrorMessage = "Value for {0} must be between {1} and {2}.")] + public int Number { get; set; } + public bool IsWinner { get; set; } + [Required] + public long UserAccountId { get; set; } + [Required] + public long RaffleId { get; set; } + public UserAccount? Owner { get; set; } + public Raffle? Raffle { get; set; } + } +}
\ No newline at end of file diff --git a/Models/UserAccount.cs b/Models/UserAccount.cs index 8b70187..333138d 100644 --- a/Models/UserAccount.cs +++ b/Models/UserAccount.cs @@ -6,5 +6,6 @@ namespace BackendPIA.Models { [StringLength(64)] public string? SessionToken { get; set; } public DateTime? SessionTokenExpiryTime { get; set; } + public ICollection<Ticket>? Tickets { get; set; } } }
\ No newline at end of file |