예제 #1
0
        public async Task SaveUserCartAsync(UserCart userCart, CancellationToken cancellationToken = default)
        {
            var userHasCart = await userCartRepository.DoesUserHaveItemsInCart(userCart.UserId, cancellationToken);

            if (!userHasCart)
            {
                var dtoUserCart = userCart.CreateUserCartDto();
                await userCartRepository.AddAsync(dtoUserCart, cancellationToken);
            }
            if (userCart.ItemIds != null)
            {
                await userCartItemsRepository.AddAsync(userCart.UserCartId, userCart.ItemIds, cancellationToken);
            }
            if (userCart.ItemRentalIds != null)
            {
                await userCartItemRentalsRepository.AddAsync(userCart.UserCartId, userCart.ItemRentalIds, cancellationToken);
            }
        }
 public async Task AddUserCartItems_Object()
 {
     await userCartItemRentalsRepository.AddAsync(userCartItemRentals);
 }