diff options
author | HombreLaser <sebastian-440@live.com> | 2022-11-29 16:36:28 -0600 |
---|---|---|
committer | HombreLaser <sebastian-440@live.com> | 2022-11-29 16:36:28 -0600 |
commit | 1dee2f9b9ef0fc35bcbcea01b2a8477bda51063f (patch) | |
tree | 63dfb98f221cd0b53c4704da8eb982d1579696b2 /Services | |
parent | 342f482206f875e0466216ec176eb341dd506d9e (diff) |
Añadido query de nombremain
Diffstat (limited to 'Services')
-rw-r--r-- | Services/IRaffleService.cs | 1 | ||||
-rw-r--r-- | Services/RaffleService.cs | 4 |
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) { |