示例#1
0
        public void SeedProducts(VCompareDbContext context)
        {
            var products = new[] {
                new Product {
                    Id   = 1,
                    Name = "Basic electricity tariff"
                },
                new Product {
                    Id   = 2,
                    Name = "Packaged tariff"
                }
            };

            context.Products.AddRange(products);

            context.SaveChanges();
        }
示例#2
0
        public void SeedPriceCalculationModels(VCompareDbContext context)
        {
            var priceCalculationModels = new[] {
                new PriceCalculationModel {
                    ProductId   = 1,
                    Amount      = 5,
                    Base        = 12,
                    PricePerKWH = 0.22m
                },
                new PriceCalculationModel {
                    ProductId   = 2,
                    Amount      = 800,
                    Base        = 1,
                    Limit       = 4000,
                    PricePerKWH = 0.30m
                }
            };

            context.PriceCalculationModels.AddRange(priceCalculationModels);

            context.SaveChanges();
        }