示例#1
0
        //public ViewResult Index(string returnUrl)
        //{
        //    return View(new CartIndexViewModel
        //    {
        //        Cart = GetCart(),
        //        ReturnUrl = returnUrl
        //    });
        //}

        public RedirectToActionResult RemoveFromCart(int Id, string returnUrl)
        {
            Species species = repository.Species.FirstOrDefault(p => p.Id == Id);

            if (species != null)
            {
                CartList cartlist = GetCart();
                cartlist.RemoveItem(species);
                SaveCart(cartlist);
            }
            return(RedirectToAction("Index", new { returnUrl }));
        }