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")); }
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")); }