Skip to content

Commit 8a07b30

Browse files
committed
fixes
1 parent 6e13f54 commit 8a07b30

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
@@ -153,7 +153,7 @@ public async Task<IHttpActionResult> ValidateBasket(int userId, CartContent cart
153153
return BadRequest("Your cart is empty!");
154154
}
155155
var purchaseContents = new List<purchaseContent>();
156-
156+
157157
foreach (CartContent item in basket)
158158
{
159159
var purchaseContent = new purchaseContent();
@@ -162,18 +162,18 @@ public async Task<IHttpActionResult> ValidateBasket(int userId, CartContent cart
162162
purchaseContent.productQuantity = item.productQuantity;
163163
purchaseContents.Add(purchaseContent);
164164

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

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

0 commit comments

Comments
 (0)