private void Seed() { using (var context = new AlbellicartContext(ContextOptions)) { context.Database.EnsureDeleted(); context.Database.EnsureCreated(); var order = new Order { OrderLine = new List <OrderLine> { new OrderLine { ProductType = Enums.ProductType.Calendar, Quantity = 1 }, new OrderLine { ProductType = Enums.ProductType.Canvas, Quantity = 2 }, new OrderLine { ProductType = Enums.ProductType.Cards, Quantity = 3 }, } }; context.AddRange(order); context.SaveChanges(); } }
public Order AddOrder(Order order) { // Note: This sample requires the database to be created before running. context.Order.Add(order); context.SaveChanges(); return(order); }