Skip to content

Commit 0934b3d

Browse files
committed
vérif quantités positives
1 parent 2401ae8 commit 0934b3d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Zenergy/Zenergy/Controllers/ApiControllers/CartContentsController.cs

+2-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public async Task<IHttpActionResult> PutCartContent(int userId, CartContentModel
6262
{
6363
return NotFound();
6464
}
65-
65+
if (cartContent.productQuantity < 0) return BadRequest("Please choose a positive product quantity!");
6666
//Verify if the quantity in the cartContent if inferior to the available quantity for the product
6767
int enoughProductInStock = db.product.Where(p => p.productId == cartContent.productId).FirstAsync().Result.availableQty.Value;
6868
if (cartContent.productQuantity > enoughProductInStock)
@@ -100,6 +100,7 @@ public async Task<IHttpActionResult> PostCartContent(int userId,CartContentModel
100100
{
101101
return BadRequest();
102102
}
103+
if (cartContent.productQuantity < 0) return BadRequest("Please choose a positive product quantity!");
103104
if (!CartContentExists(userId, cartContent.productId))
104105
{
105106
//Verify if the quantity in the cartContent if inferior to the available quantity for the product

0 commit comments

Comments
 (0)