public async Task <ActionResult> UpdateProductReserved(int id, [FromBody] UpdateQuantity quantity) { var(product, errors) = await _productBusinessComponent.UpdateProductReserved(id, quantity.Quantity ?? 0); if (errors.IsValid) { return(Ok(_mapper.Map <Product>(product))); } return(_mapper.Map <ActionResult>(errors)); }
public async Task <ActionResult> UpdateProduct(int productId, [FromBody] UpdateQuantity itemQuantity) { var userId = User.Identity.Name; var(basket, errors) = await _basketBusinessComponent.UpdateItemInBasket(userId, productId, itemQuantity.Quantity ?? 0); if (errors.IsValid) { return(Ok(_mapper.Map <Basket>(basket))); } return(_mapper.Map <ActionResult>(errors)); }