private static void PopulateData(MusicStoreContext context) { var genres = Enumerable.Range(1, 10).Select(n => new Genre()); context.AddRange(genres); context.SaveChanges(); }
private Task<List<Album>> GetTopSellingAlbumsAsync(MusicStoreContext dbContext, int count) { // Group the order details by album and return // the albums with the highest count return dbContext.Albums .OrderByDescending(a => a.OrderDetails.Count) .Take(count) .ToListAsync(); }
private async Task<List<Album>> GetTopSellingAlbumsAsync(MusicStoreContext dbContext, int count) { // Group the order details by album and return // the albums with the highest count // TODO [EF] We don't query related data as yet, so the OrderByDescending isn't doing anything return await dbContext.Albums .OrderByDescending(a => a.OrderDetails.Count()) .Take(count) .ToListAsync(); }
private static void PopulateData(MusicStoreContext context, string cartId, string albumTitle, int itemCount) { var album = new Album() { AlbumId = 1, Title = albumTitle, }; var cartItems = Enumerable.Range(1, itemCount).Select(n => new CartItem() { AlbumId = 1, Album = album, Count = 1, CartId = cartId, }).ToArray(); context.AddRange(cartItems); context.SaveChanges(); }
public ShoppingCart(MusicStoreContext db) { _db = db; }
public HomeController(MusicStoreContext context) { db = context; }
public static ShoppingCart GetCart(MusicStoreContext db, HttpContext context) => GetCart(db, GetCartId(context));
public static ShoppingCart GetCart(MusicStoreContext db, HttpContext context) { var cart = new ShoppingCart(db); cart.ShoppingCartId = cart.GetCartId(context); return cart; }
public GenresApiController(MusicStoreContext storeContext) { _storeContext = storeContext; }
public static ShoppingCart GetCart(MusicStoreContext db, string cartId) => new ShoppingCart(db, cartId);
public StoreManagerController(MusicStoreContext dbContext, IOptions<AppSettings> options) { DbContext = dbContext; _appSettings = options.Value; }
public CheckoutController(MusicStoreContext context) { db = context; }
public CartSummaryComponent(MusicStoreContext dbContext) { DbContext = dbContext; }
public AnnouncementComponent(MusicStoreContext dbContext, IMemoryCache cache, ISystemClock clock) { DbContext = dbContext; Cache = cache; Clock = clock; }
public CartSummaryComponent(MusicStoreContext context) { db = context; }
public ShoppingCartController(MusicStoreContext context) { db = context; }
public ShoppingCart(MusicStoreContext dbContext) { _dbContext = dbContext; }
public StoreManagerController(MusicStoreContext context) { db = context; }
public GenreMenuComponent(MusicStoreContext dbContext) { DbContext = dbContext; }
public StoreManagerController(MusicStoreContext dbContext) { DbContext = dbContext; }
public ShoppingCartController(MusicStoreContext dbContext) { DbContext = dbContext; }
public ShoppingCartController(MusicStoreContext dbContext, ILogger<ShoppingCartController> logger) { DbContext = dbContext; _logger = logger; }
private ShoppingCart(MusicStoreContext dbContext, string id) { _dbContext = dbContext; _shoppingCartId = id; }
public static ShoppingCart GetCart(MusicStoreContext dbContext, string shoppingCartId) { return(new ShoppingCart(dbContext, shoppingCartId)); }
public ArtistsApiController(MusicStoreContext storeContext) { _storeContext = storeContext; }
public AlbumsApiController(MusicStoreContext storeContext) { _storeContext = storeContext; }
public GenreMenuComponent(MusicStoreContext context) { db = context; }