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

                context.Representative.AddRange(
                    //new Representative
                    //{
                    //    LastName = "Johnson"
                    //},

                    //new Representative
                    //{
                    //    LastName = "Smith"
                    //},

                    //new Representative
                    //{
                    //    LastName = "Jackson"
                    //},

                    //new Representative
                    //{
                    //    LastName = "Armstrong"
                    //}
                    );
                context.SaveChanges();
            }
        }
Esempio n. 2
0
 public RepresentativesController(RepresentativeContext context)
 {
     _context = context;
     _representativeService = new RepresentativeService();
 }