Esempio n. 1
0
 protected void btnAdd_Click(object sender, EventArgs e)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         UserCartFacade facade = new UserCartFacade(uow);
         facade.AddToCart(CurrentUserContext.ShoppingCart, CurrentInstance.ProductId, new ProductToCartItemConverter(CurrentUserContext.CurrentLanguage.Id));
     }
 }
 private void ucProductList_ItemActionCommand(object sender, CommandEventArgs e)
 {
     using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
     {
         UserCartFacade facade    = new UserCartFacade(uow);
         object         productId = Convert.ToInt32(e.CommandArgument);
         facade.AddToCart(CurrentUserContext.ShoppingCart, productId, new ProductToCartItemConverter(CurrentUserContext.CurrentLanguage.Id));
     }
 }
Esempio n. 3
0
        public RedirectToRouteResult RemoveFromCart(CartDto cart, int productId)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                UserCartFacade facade = new UserCartFacade(uow);
                facade.RemoveFromCart(cart, productId);
            }

            return(RedirectToAction(IndexAction));
        }
Esempio n. 4
0
        public ViewResult AddToCart(CartDto cart, int productId)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                UserCartFacade facade = new UserCartFacade(uow);
                facade.AddToCart(cart, productId, new ProductToCartItemConverter(CurrentLanguageId));
            }

            return(View("Summary", cart));
        }
 private void ClearCart()
 {
     UserCartFacade.ClearCart(CurrentUserContext.ShoppingCart);
 }
 protected void btnClearCart_Click(object sender, EventArgs e)
 {
     UserCartFacade.ClearCart(CurrentUserContext.ShoppingCart);
     LoadData();
 }