예제 #1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new MSAMemeAPIContext(
                       serviceProvider.GetRequiredService <DbContextOptions <MSAMemeAPIContext> >()))
            {
                // 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();
            }
        }
예제 #2
0
 public MemeController(MSAMemeAPIContext context, IConfiguration configuration)
 {
     _context       = context;
     _configuration = configuration;
 }