summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Forms/TicketDTO.cs3
-rw-r--r--Forms/TicketForm.cs4
-rw-r--r--Models/Ticket.cs3
-rw-r--r--Profiles/TicketProfile.cs12
-rw-r--r--Profiles/UserAccountProfile.cs3
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
});
}