Ejemplo n.º 1
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new TanimotoCoefficientContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <TanimotoCoefficientContext> >()))
            {
                // Look for any movies.
                if (context.Critic.Any())
                {
                    return;   // DB has been seeded
                }

                context.Critic.AddRange(
                    new Critic
                {
                    FullName  = "John Adams",
                    MovieName = "Titanic",
                    Rating    = 5.0
                },

                    new Critic
                {
                    FullName  = "John Adams",
                    MovieName = "Star Wars",
                    Rating    = 4.0
                },

                    new Critic
                {
                    FullName  = "Bruce Swift",
                    MovieName = "Titanic",
                    Rating    = 4.0
                },

                    new Critic
                {
                    FullName  = "Bruce Swift",
                    MovieName = "Star Wars",
                    Rating    = 3.0
                }
                    );;
                context.SaveChanges();
            }
        }
Ejemplo n.º 2
0
 public TanimotoController(TanimotoCoefficientContext context)
 {
     _context = context;
 }