public ActionResult <IEnumerable <Bet> > Get() { using (var dbContext = new EzBetDbContext()) { return(dbContext.Bets.ToList()); } }
public void Delete(int id) { using (var dbContext = new EzBetDbContext(contextOptions)) { var betToDelete = dbContext.Find <Bet>(id); dbContext.Remove(betToDelete); } }
public ActionResult <IEnumerable <Bet> > Get() { using (var dbContext = new EzBetDbContext(contextOptions)) { var bets = dbContext.Bets.ToList(); return(bets); } }
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); } }