示例#1
0
        public async Task <ActionResult> Add(int Id)
        {
            CartItemsRepository cartItemsRepository = new CartItemsRepository();
            CartItem            cartItem            = await cartItemsRepository.GetCartItemAsync(Id);

            cartItem.Amount++;
            await cartItemsRepository.SaveCartItemAsync(cartItem); //TODO: Obsluga result

            return(RedirectToAction("Index"));
        }
示例#2
0
        public async Task <ActionResult> Remove(int Id)
        {
            CartItemsRepository cartItemsRepository = new CartItemsRepository();
            CartItem            cartItem            = await cartItemsRepository.GetCartItemAsync(Id);

            cartItem.Amount--;
            if (cartItem.Amount <= 0)
            {
                await cartItemsRepository.DeleteCartItemAsync(cartItem);
            }
            else
            {
                await cartItemsRepository.SaveCartItemAsync(cartItem); //TODO: Obsluga result
            }
            return(RedirectToAction("Index"));
        }