// GET: ShopingCart/AddToShopingCart
        public RedirectToActionResult AddToShopingCart(int bookId, int qty = 1)
        {
            var selectedBook = _bookRepository.Books.FirstOrDefault(b => b.Id == bookId);

            if (selectedBook != null)
            {
                _shopingCart.AddToShopingCart(selectedBook, qty);
            }
            return(RedirectToAction("Book", "Gallery", new { id = bookId }));
        }
예제 #2
0
        // GET: ShopingCart/AddToShopingCart
        public RedirectToActionResult AddToShopingCart(int bookId)
        {
            var selectedBook = _bookRepository.Books.FirstOrDefault(b => b.Id == bookId);

            if (selectedBook != null)
            {
                _shopingCart.AddToShopingCart(selectedBook, 1);
            }
            return(RedirectToAction("Index"));
        }