/// <summary> /// Remove an Item from the shoping chart /// </summary> public HttpResponse <bool> RemoveItem(ShoppingCartCommand command) { return(new ApiHttpClient().DeleteRequest <bool>(ApiUrls.ShoppingRemoveItem, AppSettings.OAuthToken, command)); }
/// <summary> /// Update an Item in the shoping chart /// </summary> public HttpResponse <bool> UpdateItem(ShoppingCartCommand command) { return(new ApiHttpClient().PutRequest <bool>(ApiUrls.ShoppingUpdateItem, AppSettings.OAuthToken, command)); }
public async Task <ActionResult <ShoppingCartViewModel> > AddProductShoppingCartAsync(ShoppingCartCommand shoppingCartCommand) { var existingProduct = await _queries.FindByIdAsync(shoppingCartCommand.ProductId); var existingUser = await _userQueries.FindByUsernameAsync(shoppingCartCommand.Username); if (existingProduct == null || existingUser == null) { return(NotFound()); } var existingProductInShoppingCart = await _shoppingCartQueries.FindByIdUsernameAsync(shoppingCartCommand.ProductId, shoppingCartCommand.Username); if (existingProductInShoppingCart != null) { return(Conflict()); } var shoppingCart = _mapper.Map <ShoppingCart>(shoppingCartCommand); await _shoppingCartBehavior.CreateShoppingCartAsync(shoppingCart, existingProduct.Price); var shoppingCartViewModel = await _shoppingCartQueries.FindByIdAsync(shoppingCart.Id); return(shoppingCartViewModel); }