Пример #1
0
 public ActionResult <IEnumerable <Bet> > Get()
 {
     using (var dbContext = new EzBetDbContext())
     {
         return(dbContext.Bets.ToList());
     }
 }
Пример #2
0
 public void Delete(int id)
 {
     using (var dbContext = new EzBetDbContext(contextOptions))
     {
         var betToDelete = dbContext.Find <Bet>(id);
         dbContext.Remove(betToDelete);
     }
 }
Пример #3
0
 public ActionResult <IEnumerable <Bet> > Get()
 {
     using (var dbContext = new EzBetDbContext(contextOptions))
     {
         var bets = dbContext.Bets.ToList();
         return(bets);
     }
 }
Пример #4
0
 public ActionResult <Bet> Get(int id)
 {
     using (var dbContext = new EzBetDbContext(contextOptions))
     {
         var bet = dbContext.Find <Bet>(id);
         if (bet == null)
         {
             return(NotFound());
         }
         return(bet);
     }
 }