예제 #1
0
        private static void PopulateData(MusicStoreContext context)
        {
            var genres = Enumerable.Range(1, 10).Select(n => new Genre());

            context.AddRange(genres);
            context.SaveChanges();
        }
예제 #2
0
        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();
        }
예제 #3
0
        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();
        }
예제 #5
0
 public ShoppingCart(MusicStoreContext db)
 {
     _db = db;
 }
예제 #6
0
 public HomeController(MusicStoreContext context)
 {
     db = context;
 }
예제 #7
0
 public static ShoppingCart GetCart(MusicStoreContext db, HttpContext context)
 => GetCart(db, GetCartId(context));
예제 #8
0
 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;
 }
예제 #10
0
 public static ShoppingCart GetCart(MusicStoreContext db, string cartId)
     => new ShoppingCart(db, cartId);
 public StoreManagerController(MusicStoreContext dbContext, IOptions<AppSettings> options)
 {
     DbContext = dbContext;
     _appSettings = options.Value;
 }
예제 #12
0
 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;
 }
예제 #15
0
 public CartSummaryComponent(MusicStoreContext context)
 {
     db = context;
 }
 public ShoppingCartController(MusicStoreContext context)
 {
     db = context;
 }
예제 #17
0
 public static ShoppingCart GetCart(MusicStoreContext db, HttpContext context) 
     => GetCart(db, GetCartId(context));
예제 #18
0
 public ShoppingCart(MusicStoreContext dbContext)
 {
     _dbContext = dbContext;
 }
예제 #19
0
 public StoreManagerController(MusicStoreContext context)
 {
     db = context;
 }
예제 #20
0
 public GenreMenuComponent(MusicStoreContext dbContext)
 {
     DbContext = dbContext;
 }
예제 #21
0
 public ShoppingCart(MusicStoreContext db)
 {
     _db = db;
 }
예제 #22
0
 public StoreManagerController(MusicStoreContext dbContext)
 {
     DbContext = dbContext;
 }
 public ShoppingCartController(MusicStoreContext dbContext)
 {
     DbContext = dbContext;
 }
예제 #24
0
 public ShoppingCartController(MusicStoreContext dbContext, ILogger<ShoppingCartController> logger)
 {
     DbContext = dbContext;
     _logger = logger;
 }
예제 #25
0
 private ShoppingCart(MusicStoreContext dbContext, string id)
 {
     _dbContext      = dbContext;
     _shoppingCartId = id;
 }
예제 #26
0
 public ShoppingCart(MusicStoreContext dbContext)
 {
     _dbContext = dbContext;
 }
예제 #27
0
 public static ShoppingCart GetCart(MusicStoreContext db, string cartId)
 => new ShoppingCart(db, cartId);
예제 #28
0
 public static ShoppingCart GetCart(MusicStoreContext dbContext, string shoppingCartId)
 {
     return(new ShoppingCart(dbContext, shoppingCartId));
 }
 public ArtistsApiController(MusicStoreContext storeContext)
 {
     _storeContext = storeContext;
 }
예제 #30
0
 private ShoppingCart(MusicStoreContext dbContext, string id)
 {
     _dbContext = dbContext;
     _shoppingCartId = id;
 }
 public AlbumsApiController(MusicStoreContext storeContext)
 {
     _storeContext = storeContext;
 }
예제 #32
0
 public GenreMenuComponent(MusicStoreContext context)
 {
     db = context;
 }