diff --git a/BulkyWeb/Areas/Customer/Controllers/CartController.cs b/BulkyWeb/Areas/Customer/Controllers/CartController.cs index b56707c..2f9958b 100644 --- a/BulkyWeb/Areas/Customer/Controllers/CartController.cs +++ b/BulkyWeb/Areas/Customer/Controllers/CartController.cs @@ -81,7 +81,8 @@ public IActionResult SummaryPOST() ShoppingCartVM.OrderHeader.OrderDate = System.DateTime.Now; ShoppingCartVM.OrderHeader.ApplicationUserId = userId; - ShoppingCartVM.OrderHeader.ApplicationUser = _unitOfWork.ApplicationUser.Get(u => u.Id == userId); + + ApplicationUser applicationUser = _unitOfWork.ApplicationUser.Get(u => u.Id == userId); foreach (var cart in ShoppingCartVM.ShoppingCartList) { @@ -89,9 +90,9 @@ public IActionResult SummaryPOST() ShoppingCartVM.OrderHeader.OrderTotal += (cart.Price * cart.Count); } - if (ShoppingCartVM.OrderHeader.ApplicationUser.CompanyId.GetValueOrDefault() == 0) + if (applicationUser.CompanyId.GetValueOrDefault() == 0) { - //it is a regular customer account and we need to capture payment + //it is a regular customer ShoppingCartVM.OrderHeader.PaymentStatus = SD.PaymentStatusPending; ShoppingCartVM.OrderHeader.OrderStatus = SD.StatusPending; } @@ -117,7 +118,19 @@ public IActionResult SummaryPOST() _unitOfWork.OrderDetail.Add(orderDetail); _unitOfWork.Save(); } - return View(ShoppingCartVM); + if (applicationUser.CompanyId.GetValueOrDefault() == 0) + { + //it is a regular customer account and we need to capture payment + //stripe logic + + } + + return RedirectToAction(nameof(OrderConfirmation), new {id= ShoppingCartVM.OrderHeader.Id}); + } + + public IActionResult OrderConfirmation(int id) + { + return View(id); } private double GetPriceBasedOnQuantity(ShoppingCart shoppingCart) diff --git a/BulkyWeb/Areas/Customer/Views/Cart/OrderConfirmation.cshtml b/BulkyWeb/Areas/Customer/Views/Cart/OrderConfirmation.cshtml new file mode 100644 index 0000000..df3a6be --- /dev/null +++ b/BulkyWeb/Areas/Customer/Views/Cart/OrderConfirmation.cshtml @@ -0,0 +1,13 @@ +@model int + +