コード例 #1
0
        public async Task AddAsync(UserCartItems userCartItems, CancellationToken cancellationToken = default)
        {
            await toolShedContext.UserCartItemsSet
            .AddAsync(userCartItems);

            await toolShedContext.SaveChangesAsync(cancellationToken);
        }
コード例 #2
0
        public async Task AddAsync(Guid userCartId, Guid itemId, CancellationToken cancellationToken = default)
        {
            var userCartItems = new UserCartItems
            {
                UserCartId = userCartId,
                ItemId     = itemId
            };
            await toolShedContext.UserCartItemsSet
            .AddAsync(userCartItems, cancellationToken);

            await toolShedContext.SaveChangesAsync(cancellationToken);
        }
コード例 #3
0
        public async Task AddAsync(Guid userCartId, IEnumerable <Guid> itemIds, CancellationToken cancellationToken = default)
        {
            foreach (var itemId in itemIds)
            {
                var userCartItems = new UserCartItems
                {
                    UserCartId = userCartId,
                    ItemId     = itemId
                };
                await toolShedContext.UserCartItemsSet
                .AddAsync(userCartItems, cancellationToken);

                await toolShedContext.SaveChangesAsync(cancellationToken);
            }
        }
コード例 #4
0
 public UserCartItemsRepositoryTests()
 {
     userCartItems           = CreateUserCartItems();
     userCartItemsRepository = GetInMemoryUserCartRepository();
 }