public void DeleteCart_True() { var cartVM = new CartViewModel(); cartVM.PurchasedProducts.Add(product); cartVM.ClearCart(); Assert.AreEqual(0, cartVM.PurchasedProducts.Count); }
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)); } }
public ActionResult Clear() { CartViewModel.ClearCart(User.Identity.Name); return(RedirectToAction("Index")); }