Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
 public DetailsModel(RealEstate.Models.RealEstateContext context)
 {
     _context = context;
 }
Exemplo n.º 3
0
 public DeleteModel(RealEstate.Models.RealEstateContext context)
 {
     _context = context;
 }
Exemplo n.º 4
0
 public EditModel(RealEstate.Models.RealEstateContext context)
 {
     _context = context;
 }
Exemplo n.º 5
0
 public IndexModel(RealEstate.Models.RealEstateContext context)
 {
     _context = context;
 }
Exemplo n.º 6
0
 public PropertyRepository(RealEstateContext realEstateContext)
 {
     _realEstateContext = realEstateContext;
 }