Esempio n. 1
0
        public void DeleteCart(CartViewModel c)
        {
            Cart cart = _cartRepo.GetCart(c.Email);

            if (cart != null)
            {
                _cartRepo.DeleteCart(cart);
            }
        }
Esempio n. 2
0
        public CartViewModel GetCart(string email)
        {
            var cart   = _cartsRepo.GetCart(email);
            var result = _mapper.Map <Cart, CartViewModel>(cart);

            return(result);
        }
        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);
            }
        }
Esempio n. 4
0
 public async Task <Carts> GetCart(int userId)
 {
     return(await _repCart.GetCart(userId));
 }
        public IQueryable <CartViewModel> GetCart(Guid id)
        {
            var cart = _cartsRepo.GetCart(id).ProjectTo <CartViewModel>(_mapper.ConfigurationProvider);

            return(cart);
        }