public static void Initialize(ShittyTwitterContext context) { context.Database.EnsureCreated(); if (context.ShittyTweets.Count() == 0) { context.ShittyTweets.Add(new ShittyTweet { Message = "This is a shitty tweet", Author = "Anonymous" }); context.ShittyTweets.Add(new ShittyTweet { Message = "This is another shitty tweet", Author = "Me" }); context.SaveChanges(); } }
public ShittyTweetsController(ShittyTwitterContext context) { _context = context; }