diff options
author | HombreLaser <sebastian-440@live.com> | 2022-11-23 17:56:10 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2022-11-23 17:56:10 -0600 |
commit | 8ea8f4f9a9bbb6db9abe1294163d2444d1e5da7b (patch) | |
tree | dd02d5082823d968eb7ba6aa8dcd4a580f4b318d | |
parent | e1c7efd99f631ab297f75c6aef041ec2cd884327 (diff) |
AƱadidos DTOs de ticket
-rw-r--r-- | Forms/TicketDTO.cs | 3 | ||||
-rw-r--r-- | Forms/TicketForm.cs | 4 | ||||
-rw-r--r-- | Models/Ticket.cs | 3 | ||||
-rw-r--r-- | Profiles/TicketProfile.cs | 12 | ||||
-rw-r--r-- | Profiles/UserAccountProfile.cs | 3 |
5 files changed, 18 insertions, 7 deletions
diff --git a/Forms/TicketDTO.cs b/Forms/TicketDTO.cs index 0732708..6b47379 100644 --- a/Forms/TicketDTO.cs +++ b/Forms/TicketDTO.cs @@ -3,6 +3,7 @@ namespace BackendPIA.Forms { public long Id { get; set; } public int Number { get; set; } public bool IsWinner { get; set; } - public long RaffleId { get; set; } + public long RaffleId{ get; set; } + public string? UserAccountId { get; set; } } }
\ No newline at end of file diff --git a/Forms/TicketForm.cs b/Forms/TicketForm.cs index 26e7302..98901df 100644 --- a/Forms/TicketForm.cs +++ b/Forms/TicketForm.cs @@ -5,9 +5,5 @@ namespace BackendPIA.Forms { [Required] [Range(1, 54, ErrorMessage = "Value for {0} must be between {1} and {2}.")] public int Number { get; set; } - [Required] - public long UserAccountId { get; set; } - [Required] - public long RaffleId { get; set; } } }
\ No newline at end of file diff --git a/Models/Ticket.cs b/Models/Ticket.cs index e459027..a876259 100644 --- a/Models/Ticket.cs +++ b/Models/Ticket.cs @@ -8,8 +8,9 @@ namespace BackendPIA.Models { public int Number { get; set; } public bool IsWinner { get; set; } [Required] - public long UserAccountId { get; set; } + public string? UserAccountId { get; set; } [Required] + public long RaffleId { get; set; } public UserAccount? Owner { get; set; } public Raffle? Raffle { get; set; } diff --git a/Profiles/TicketProfile.cs b/Profiles/TicketProfile.cs new file mode 100644 index 0000000..f9c4555 --- /dev/null +++ b/Profiles/TicketProfile.cs @@ -0,0 +1,12 @@ +using AutoMapper; +using BackendPIA.Models; +using BackendPIA.Forms; + +namespace BackendPIA.Profiles { + public class TicketProfile : Profile { + public TicketProfile() { + CreateMap<TicketForm, Ticket>(); + CreateMap<Ticket, TicketDTO>(); + } + } +} diff --git a/Profiles/UserAccountProfile.cs b/Profiles/UserAccountProfile.cs index 7695265..0b14efc 100644 --- a/Profiles/UserAccountProfile.cs +++ b/Profiles/UserAccountProfile.cs @@ -20,7 +20,8 @@ namespace BackendPIA.Profiles { Id = ticket.Id, Number = ticket.Number, IsWinner = ticket.IsWinner, - RaffleId = ticket.RaffleId + RaffleId = ticket.RaffleId, + UserAccountId = user.Id }); } |