public static void Initialize(IServiceProvider serviceProvider) { using (var context = new RealEstateContext( serviceProvider.GetRequiredService <DbContextOptions <RealEstateContext> >())) { // Look for any Propertys. if (context.Property.Any()) { return; // DB has been seeded } context.Property.AddRange( new Property { Price = 100003M, Address = "бул. „Цар Освободител“ 10" }, new Property { Price = 932342.99M, Address = "ул. „Кузман Шапкарев“ 6" }, new Property { Price = 2342123.99M, Address = "ул. „Иван Денкоглу“ 15Б, 1000 Център, София" }, new Property { Price = 21341234.43M, Address = "ул. „Позитано“ 24" } ); context.SaveChanges(); } }
public DetailsModel(RealEstate.Models.RealEstateContext context) { _context = context; }
public DeleteModel(RealEstate.Models.RealEstateContext context) { _context = context; }
public EditModel(RealEstate.Models.RealEstateContext context) { _context = context; }
public IndexModel(RealEstate.Models.RealEstateContext context) { _context = context; }
public PropertyRepository(RealEstateContext realEstateContext) { _realEstateContext = realEstateContext; }