public static void Initialize(IServiceProvider serviceProvider) { using (var context = new MemebankContext( serviceProvider.GetRequiredService <DbContextOptions <MemebankContext> >())) { // Look for any movies. if (context.MemeItem.Count() > 0) { return; // DB has been seeded } context.MemeItem.AddRange( new MemeItem { Title = "Is Mayo an Instrument?", Url = "https://i.kym-cdn.com/photos/images/original/001/371/723/be6.jpg", Tags = "spongebob", Uploaded = "07-10-18 4:20T18:25:43.511Z", Width = "768", Height = "432" } ); context.SaveChanges(); } }
public MemeController(MemebankContext context, IConfiguration configuration) { _context = context; _configuration = configuration; }