public ActionResult SeedDB() { if (_context.Car.Count() == 0) { Car car1 = new Car { Make = "Ferrari", Model = "488", Year = 2015, Colour = "Red", VIN = "123nice" }; Car car2 = new Car { Make = "Alfa Romeo", Model = "Giulia", Year = 2019, Colour = "Blue", VIN = "456great" }; _context.Car.AddRange(car1, car2); _context.SaveChanges(); } return(RedirectToAction(nameof(Index))); }
public ActionResult SeedDB() { if (_context.Member.Count() == 0) { Member member1 = new Member { FirstName = "Josh", LastName = "Piedimonte", BirthDate = new DateTime(1994, 8, 18), Company = "Good corp", Email = "*****@*****.**", Position = "Developer", UserName = "******" }; Member member2 = new Member { FirstName = "Another", LastName = "Guy", BirthDate = new DateTime(1996, 8, 18), Company = "Good corp", Email = "*****@*****.**", Position = "Jr Developer", UserName = "******" }; _context.Member.AddRange(member1, member2); _context.SaveChanges(); } return(RedirectToAction(nameof(Index))); }
public ActionResult SeedDB() { // var dealerships = new DealershipMgr().Get(); if (_context.Dealership.Count() == 0) { Dealership deal1 = new Dealership { Id = 1, Name = "Joshs Cars", Email = "*****@*****.**", PhoneNumber = "905-123-4567" }; Dealership deal2 = new Dealership { Id = 2, Name = "Used Cars", Email = "*****@*****.**", PhoneNumber = "905-122-3461" }; _context.Dealership.AddRange(deal1, deal2); _context.SaveChanges(); } return(RedirectToAction(nameof(Index))); }