Esempio n. 1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new RazorCrudGameContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <RazorCrudGameContext> >()))
            {
                // Look for any movies.
                if (context.Game.Any())
                {
                    return;   // DB has been seeded
                }

                context.Game.AddRange(
                    new Game
                {
                    Title       = "Star Wars Jedi: Fallen Order",
                    Developer   = "Respawn Entertainment",
                    Genre       = "Action Adventure",
                    ReleaseDate = DateTime.Parse("2019-11-15"),
                },
                    new Game
                {
                    Title       = "Rise of The Tomb raider",
                    Developer   = "Crystal Dynamics",
                    Genre       = "Action Adventure",
                    ReleaseDate = DateTime.Parse("2015-11-10"),
                }

                    );
                context.SaveChanges();
            }
        }
Esempio n. 2
0
 public EditModel(RazorCrudGameContext context)
 {
     _context = context;
 }
 public DetailsModel(RazorCrudGameContext context)
 {
     _context = context;
 }
Esempio n. 4
0
 public IndexModel(RazorCrudGameContext context)
 {
     _context = context;
 }
Esempio n. 5
0
 public CreateModel(RazorCrudGameContext context)
 {
     _context = context;
 }
Esempio n. 6
0
 public DeleteModel(RazorCrudGameContext context)
 {
     _context = context;
 }