示例#1
0
 public User GetById(int id)
 {
     using (var dbContext = new LottoDbContext(_connectionString))
     {
         return(dbContext.Users.FirstOrDefault(x => x.Id == id));
     }
 }
示例#2
0
 public IEnumerable <RoundResult> GetAll()
 {
     using (var dbContext = new LottoDbContext(_connectionString))
     {
         return(dbContext.RoundResults.ToList());
     }
 }
示例#3
0
 public IEnumerable <User> GetAll()
 {
     using (var dbContext = new LottoDbContext(_connectionString))
     {
         return(dbContext.Users.ToList());
     }
 }
示例#4
0
 public RoundResults GetById(int id)
 {
     using (var dbContext = new LottoDbContext(_connectionString))
     {
         return(dbContext.RoundResults.FirstOrDefault(x => x.RoundId == id));
     }
 }
示例#5
0
 public void Update(User entity)
 {
     using (var dbContext = new LottoDbContext(_connectionString))
     {
         dbContext.Users.Update(entity);
         dbContext.SaveChanges();
     }
 }
示例#6
0
 public void Delete(Ticket entity)
 {
     using (var dbContext = new LottoDbContext(_connectionString))
     {
         dbContext.Tickets.Add(entity);
         dbContext.SaveChanges();
     }
 }
示例#7
0
 public void Update(RoundResult entity)
 {
     using (var dbContext = new LottoDbContext(_connectionString))
     {
         dbContext.RoundResults.Update(entity);
         dbContext.SaveChanges();
     }
 }
示例#8
0
 public UserRepository(LottoDbContext dbContext)
 {
     _dbContext = dbContext;
 }
示例#9
0
 public TicketRepository(LottoDbContext dbContext)
 {
     _dbContext = dbContext;
 }
示例#10
0
 public UserRepository(LottoDbContext context)
 {
     _context = context;
 }
 public SessionRepository(LottoDbContext context)
 {
     _context = context;
 }
示例#12
0
 public RoundRepository(LottoDbContext dbContext)
 {
     _dbContext = dbContext;
 }
示例#13
0
 public TicketRepository(LottoDbContext context)
 {
     _context = context;
 }