Пример #1
0
        public void DeleteCart_True()
        {
            var cartVM = new CartViewModel();

            cartVM.PurchasedProducts.Add(product);
            cartVM.ClearCart();
            Assert.AreEqual(0, cartVM.PurchasedProducts.Count);
        }
Пример #2
0
        public ActionResult Checkout(OrderForm orderForm)
        {
            var cart = db.Cart.Where(x => x.UserName == orderForm.UserName).ToList();

            if (cart == null)
            {
                ModelState.AddModelError("", "Sepetinizde ürün bulunmamaktadır.");
            }

            if (ModelState.IsValid)
            {
                OrderViewModel.SaveOrder(cart, orderForm);
                CartViewModel.ClearCart(orderForm.UserName);

                return(View("Completed"));
            }
            else
            {
                return(View(orderForm));
            }
        }
Пример #3
0
        public ActionResult Clear()
        {
            CartViewModel.ClearCart(User.Identity.Name);

            return(RedirectToAction("Index"));
        }