示例#1
0
 public BasketsController(
     ShoppingBasketDbContext dbContext,
     DiscountService discountService,
     IMessageProducer <BasketCheckoutMessage> producer
     )
 {
     _dbContext       = dbContext;
     _discountService = discountService;
     _producer        = producer;
 }
        public async Task UpdatePricesForIntegrationEvent(Models.PriceUpdate priceUpdate)
        {
            await using (var shoppingBasketDbContext = new ShoppingBasketDbContext(dbContextOptions))
            {
                var basketLinesToUpdate = shoppingBasketDbContext.BasketLines.Where(x => x.EventId == priceUpdate.EventId);

                await basketLinesToUpdate.ForEachAsync((basketLineToUpdate) =>
                                                       basketLineToUpdate.Price = priceUpdate.Price
                                                       );

                await shoppingBasketDbContext.SaveChangesAsync();
            }
        }
示例#3
0
 public BasketChangeEventController(ShoppingBasketDbContext dbContext)
 {
     _dbContext = dbContext;
 }
示例#4
0
 public Handler(ShoppingBasketDbContext context)
 {
     _context = context;
 }
示例#5
0
 public RequestValidator(ShoppingBasketDbContext context)
 {
     RuleFor(x => x.BasketId).EntityExists(context, typeof(Basket));
     RuleFor(x => x.BasketLineId).EntityExists(context, typeof(BasketLine));
     RuleFor(x => x.Quantity).GreaterThanOrEqualTo(0);
 }
 public BasketLinesController(ShoppingBasketDbContext dbContext, EventCatalogService eventCatalogService)
 {
     _dbContext           = dbContext;
     _eventCatalogService = eventCatalogService;
 }
 public BasketLinesRepository(ShoppingBasketDbContext shoppingBasketDbContext)
 {
     _shoppingBasketDbContext = shoppingBasketDbContext;
 }
 public BasketRepository(ShoppingBasketDbContext shoppingBasketDbContext)
 {
     this._shoppingBasketDbContext = shoppingBasketDbContext;
 }
示例#9
0
 public BasketRepository(ShoppingBasketDbContext dbContext)
 {
     _dbContext = dbContext;
 }
 public BasketChangeEventRepository(ShoppingBasketDbContext shoppingBasketDbContext)
 {
     this.shoppingBasketDbContext = shoppingBasketDbContext;
 }
示例#11
0
 public RequestValidator(ShoppingBasketDbContext context)
 {
     RuleFor(x => x.BasketId).EntityExists(context, typeof(Basket));
 }
示例#12
0
 public EFEventRepository(ShoppingBasketDbContext shoppingBasketDbContext)
 {
     _shoppingBasketDbContext = shoppingBasketDbContext;
 }
示例#13
0
 public RequestValidator(ShoppingBasketDbContext context)
 {
     RuleFor(x => x.BasketId).EntityExists(context, typeof(Basket));
     RuleFor(x => x.BasketLineForCreation.EventId).EntityExists(context, typeof(Event));
 }
示例#14
0
 public Handler(ShoppingBasketDbContext context, IMessageBus messageBus)
 {
     _context    = context;
     _messageBus = messageBus;
 }