public static void Initialize(IServiceProvider serviceProvider) { using (var context = new HemsidaContext( serviceProvider.GetRequiredService < DbContextOptions <HemsidaContext> >())) { // Look for any movies. if (context.Login.Any()) { return; // DB has been seeded } context.Login.AddRange( new Login { UserName = "******", PassWord = "******" } ); context.SaveChanges(); } }
public LoginsController(HemsidaContext context) { _context = context; }