Skip to content

Commit bbf4e02

Browse files
committed
modif validate basket
1 parent 34a4854 commit bbf4e02

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Zenergy/Zenergy/Controllers/ApiControllers/CartContentsController.cs

+11-11
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ public async Task<IHttpActionResult> PostCartContent(int userId,CartContentModel
135135
[Route("api/users/{userId}/basket/validate")]
136136
[Authorize]
137137
[ResponseType(typeof(purchase))]
138-
public async Task<IHttpActionResult> ValidateBasket(int userId, CartContent cartContent)
138+
public async Task<IHttpActionResult> ValidateBasket(int userId)
139139
{
140140
if (!ModelState.IsValid)
141141
{
@@ -163,18 +163,18 @@ public async Task<IHttpActionResult> ValidateBasket(int userId, CartContent cart
163163
purchaseContents.Add(purchaseContent);
164164
}
165165

166-
var purchase = db.purchase.Add(new purchase() { userId = cartContent.userId, purchaseDate = DateTime.Today, user = cartContent.user, purchaseContent = purchaseContents });
166+
var purchase = db.purchase.Add(new purchase() { userId = userId, purchaseDate = DateTime.Today, purchaseContent = purchaseContents });
167167

168-
try
169-
{
170-
//Clearing the basket
171-
await ClearBasket(basket.ToListAsync().Result);
172-
}
173-
catch (DbUpdateException)
174-
{
175-
throw;
176-
}
168+
try
169+
{
170+
//Clearing the basket
171+
await ClearBasket(basket.ToListAsync().Result);
177172
}
173+
catch (DbUpdateException)
174+
{
175+
throw;
176+
}
177+
178178
return Created("api/users/{userId}/basket/validate", purchase);
179179
}
180180

0 commit comments

Comments
 (0)