コード例 #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();
            }
        }
コード例 #2
0
 public DetailsModel(RealEstate.Models.RealEstateContext context)
 {
     _context = context;
 }
コード例 #3
0
 public DeleteModel(RealEstate.Models.RealEstateContext context)
 {
     _context = context;
 }
コード例 #4
0
ファイル: Edit.cshtml.cs プロジェクト: HorizontaTorta/vilito
 public EditModel(RealEstate.Models.RealEstateContext context)
 {
     _context = context;
 }
コード例 #5
0
 public IndexModel(RealEstate.Models.RealEstateContext context)
 {
     _context = context;
 }
コード例 #6
0
 public PropertyRepository(RealEstateContext realEstateContext)
 {
     _realEstateContext = realEstateContext;
 }