public EditModel(RazorPagesHolland.Models.RazorPagesHollandContext context)
 {
     _context = context;
 }
 public DetailsModel(RazorPagesHolland.Models.RazorPagesHollandContext context)
 {
     _context = context;
 }
 public CreateModel(RazorPagesHolland.Models.RazorPagesHollandContext context)
 {
     _context = context;
 }
示例#4
0
        public static void Initialize(IServiceProvider serviceProvider)
        {
            using (var context = new RazorPagesHollandContext(
                       serviceProvider.GetRequiredService <
                           DbContextOptions <RazorPagesHollandContext> >()))
            {
                //Look for movies
                if (context.Holland.Any())
                {
                    Console.WriteLine("db alreadys seeded");
                    return;//db alreadys seeded
                }

                context.Holland.AddRange
                (

                    new Holland
                {
                    VesselName  = "Seed Data",
                    ROVDiveName = "Exploration",
                    Location    = "North Atlantic Ocean",
                    DiveDate    = DateTime.Parse("2018-01-01"),
                    VideoUrl    = "aAcQPBcCsyY",
                    Latitude    = 49.443101f,
                    Longitude   = -10.770815f
                },
                    new Holland
                {
                    VesselName  = "Seed Data",
                    ROVDiveName = "Exploration",
                    Location    = "North Atlantic Ocean",
                    DiveDate    = DateTime.Parse("2018-01-01"),
                    VideoUrl    = "aAcQPBcCsyY",
                    Latitude    = 49.443101f,
                    Longitude   = -10.770815f
                },
                    new Holland
                {
                    VesselName  = "Seed Data",
                    ROVDiveName = "Exploration",
                    Location    = "North Atlantic Ocean",
                    DiveDate    = DateTime.Parse("2018-01-01"),
                    VideoUrl    = "aAcQPBcCsyY",
                    Latitude    = 49.443101f,
                    Longitude   = -10.770815f
                },
                    new Holland
                {
                    VesselName  = "Seed Data",
                    ROVDiveName = "Exploration",
                    Location    = "North Atlantic Ocean",
                    DiveDate    = DateTime.Parse("2018-01-01"),
                    VideoUrl    = "aAcQPBcCsyY",
                    Latitude    = 49.443101f,
                    Longitude   = -10.770815f
                }

                );
                context.SaveChanges();
            }
        }