summaryrefslogtreecommitdiff
path: root/Services
diff options
context:
space:
mode:
Diffstat (limited to 'Services')
-rw-r--r--Services/IRaffleService.cs1
-rw-r--r--Services/RaffleService.cs4
2 files changed, 3 insertions, 2 deletions
diff --git a/Services/IRaffleService.cs b/Services/IRaffleService.cs
index 5102af2..d706d66 100644
--- a/Services/IRaffleService.cs
+++ b/Services/IRaffleService.cs
@@ -10,6 +10,7 @@ namespace BackendPIA.Services {
public Task<IEnumerable<int>> GetTakenTickets(long id);
public IEnumerable<Ticket> GetRaffleTickets(long id);
public Task<IEnumerable<RaffleWinner>> GetRaffleWinners(long id);
+ public IEnumerable<Prize> GetRafflePrizes(long id);
public bool RaffleExists(long id);
}
} \ No newline at end of file
diff --git a/Services/RaffleService.cs b/Services/RaffleService.cs
index bbc20f4..b0890a4 100644
--- a/Services/RaffleService.cs
+++ b/Services/RaffleService.cs
@@ -35,11 +35,11 @@ namespace BackendPIA.Services {
if(String.IsNullOrEmpty(query))
return await _context.Raffles.ToListAsync();
- return _context.Raffles.Where(r => r.Name == query);
+ return _context.Raffles.FromSql($"SELECT * FROM \"Raffles\" AS r WHERE r.\"Name\" ILIKE {query}").ToList();
}
public async Task<Raffle> GetRaffle(long id) {
- return await _context.Raffles.FindAsync(id);
+ return await _context.Raffles.Include(r => r.Prizes).FirstOrDefaultAsync(r => r.Id == id);
}
public async Task<bool> DeleteRaffle(long id) {