This repository has been archived on 2021-04-30. You can view files and clone it, but cannot push or open issues or pull requests.
blazing-workshop/BlazingPizza.Server/SeedData.cs

71 lines
2.1 KiB
C#
Raw Permalink Normal View History

2020-12-17 15:52:43 +00:00
namespace BlazingPizza.Server
{
public static class SeedData
{
public static void Initialize(PizzaStoreContext db)
{
var toppings = new Topping[]
{
new Topping()
{
Name = "Ananas",
Price = 2.50m,
},
new Topping()
{
Name = "Artischocken",
Price = 1.50m,
},
new Topping()
{
Name = "Pilze",
Price = 1.00m,
}
};
var specials = new PizzaSpecial[]
{
new PizzaSpecial()
{
Name = "Pizza Margherita",
Description = "mit Edamer",
BasePrice = 9.99m,
ImageUrl = "img/pizzas/cheese.jpg",
},
new PizzaSpecial()
{
Name = "Pizza Salami",
Description = "mit Salami",
BasePrice = 8.00m,
ImageUrl = "img/pizzas/meaty.jpg",
},
new PizzaSpecial()
{
Name = "Pizza Prosciutto",
Description = "mit Schinken",
BasePrice = 8.00m,
ImageUrl = "img/pizzas/bacon.jpg",
},
new PizzaSpecial()
{
Name = "Pizza Funghi",
Description = "mit Pilzen",
BasePrice = 8.00m,
ImageUrl = "img/pizzas/mushroom.jpg",
},
new PizzaSpecial()
{
Name = "Pizza Gyros",
Description = "mit Gyros und frischem Blattspinat",
BasePrice = 8.50m,
ImageUrl = "img/pizzas/salad.jpg",
}
};
db.Toppings.AddRange(toppings);
db.Specials.AddRange(specials);
db.SaveChanges();
}
}
}