From 5fe81d9515d71dad1e37f7ee3262a44c52e2599e Mon Sep 17 00:00:00 2001 From: HombreLaser Date: Mon, 28 Nov 2022 17:49:34 -0600 Subject: Añadido validador de límite para premios MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Services/RaffleService.cs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Services/RaffleService.cs') diff --git a/Services/RaffleService.cs b/Services/RaffleService.cs index 5d1901f..bbc20f4 100644 --- a/Services/RaffleService.cs +++ b/Services/RaffleService.cs @@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using BackendPIA.Models; +using BackendPIA.Forms; namespace BackendPIA.Services { public class RaffleService : IRaffleService { @@ -65,5 +66,13 @@ namespace BackendPIA.Services { return await _context.RaffleWinners.Include(rw => rw.UserAccount).Include(rw => rw.Raffle).Include(rw => rw.Prize) .Where(rw => rw.RaffleId == id).ToListAsync(); } + + public bool RaffleExists(long id) { + return _context.Raffles.Any(r => r.Id == id); + } + + public IEnumerable GetRafflePrizes(long id) { + return _context.Prizes.Where(p => p.RaffleId == id).ToList(); + } } } \ No newline at end of file -- cgit v1.2.3