Created database
This commit is contained in:
parent
e068536abe
commit
eec8e419ba
19 changed files with 618 additions and 4 deletions
27
Lieb/Data/DbInitializer.cs
Normal file
27
Lieb/Data/DbInitializer.cs
Normal file
|
@ -0,0 +1,27 @@
|
|||
using Lieb.Models;
|
||||
|
||||
namespace Lieb.Data
|
||||
{
|
||||
public class DbInitializer
|
||||
{
|
||||
public static void Initialize(LiebContext context)
|
||||
{
|
||||
// Look for any students.
|
||||
if (context.Users.Any())
|
||||
{
|
||||
return; // DB has been seeded
|
||||
}
|
||||
|
||||
var users = new User[]
|
||||
{
|
||||
new User{DiscordUserId=0, Name="Sarah",Birthday=DateTime.Parse("1992-01-15")},
|
||||
new User{DiscordUserId=0, Name="Lisa",Birthday=DateTime.Parse("1991-02-15")},
|
||||
new User{DiscordUserId=0, Name="Simon",Birthday=DateTime.Parse("2019-09-01")}
|
||||
};
|
||||
|
||||
context.Users.AddRange(users);
|
||||
context.SaveChanges();
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue