Example #1
0
 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
     }
 }
Example #2
0
        // 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()));
        }
Example #3
0
 public CardsController(MtG_DecktesterContext context)
 {
     _context = context;
 }