Exemplo n.º 1
0
        public RedirectToRouteResult RemoveFromCart(Cart cart, int spareId, string returnUrl)
        {
            SparePart sparepart = db.SpareParts
                .FirstOrDefault(g => g.Id == spareId);

            if (sparepart != null)
            {
                cart.RemoveLine(sparepart);
            }
            return RedirectToAction("Index", new { returnUrl });
        }
Exemplo n.º 2
0
        public virtual ActionResult RemoveFromCart(Cart cart, int spareId, string returnUrl)
        {
            SparePart sparepart = _db.FindById(spareId);

            if (sparepart != null)
            {
                cart.RemoveLine(sparepart);
            }
            return View("Index", new CartIndexViewModel
            {
                Cart = cart,
                ReturnUrl = returnUrl
            });
        }