public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MtG_DecktesterContext( serviceProvider.GetRequiredService < DbContextOptions <MtG_DecktesterContext> >())) { context.Database.Migrate(); // Creates database if not exist } }
// GET: Cards public async Task <IActionResult> Index() { //Count number of cards MtG_DecktesterContext context = new MtG_DecktesterContext(); int nCards = _context.Card.Count(); ViewBag.TotalCards = nCards; return(View(await _context.Card.ToListAsync())); }
public CardsController(MtG_DecktesterContext context) { _context = context; }