public void DeleteCart(CartViewModel c) { Cart cart = _cartRepo.GetCart(c.Email); if (cart != null) { _cartRepo.DeleteCart(cart); } }
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); } }
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); }