Example #1
0
        public int AddCart(CartViewModel c)
        {
            Cart cart = new Cart()
            {
                Id    = c.Id,
                Email = c.Email,
                price = c.Price
            };

            _cartRepo.AddCart(cart);
            return(cart.Id);
        }
        public void AddCart(Guid productId, string email, int qty)
        {
            Cart cart = _cartsRepo.GetCart(productId, email);

            if (cart == null)
            {
                qty = 1;
                _cartsRepo.AddCart(new Cart()
                {
                    email     = email,
                    productId = productId,
                    quantity  = qty
                });
            }
            else
            {
                UpdateQtyInCart(email, productId, qty);
            }
        }
Example #3
0
        public void AddCart(CartViewModel c)
        {
            var newCart = _mapper.Map <CartViewModel, Cart>(c);

            _repo.AddCart(newCart);
        }
Example #4
0
 public void AddToCart(CartViewModel item)
 {
     _cartsRepo.AddCart(_autoMapper.Map <Cart>(item));
 }