public static void EnsureSeeded(this MusicStoreDbContext context) { var artists = SampleData.Artists; var genres = SampleData.Genres; var albums = SampleData.GetAlbums(genres, artists); //Ensure we have some status if (!context.Genres.Any()) { context.AddRange(genres); context.SaveChanges(); } //Ensure we create initial Threat List if (!context.Artists.Any()) { context.AddRange(artists); context.SaveChanges(); } if (!context.Albums.Any()) { context.AddRange(albums); context.SaveChanges(); } }
public static ShoppingCart GetCart(MusicStoreDbContext context, HttpContext httpContext) { return(new ShoppingCart(context, GetCartId(httpContext))); }
private ShoppingCart(MusicStoreDbContext context, string shoppingCartId) { _context = context; _shoppingCartId = shoppingCartId; }