.
.
CC#
Created by . on 11/26/2023 in #help
why is my handler not working, also the breakpoint doesn't even get hit for it
[ValidateAntiForgeryToken] public IActionResult OnPostPlaceOrder() { try { if (!_userManager.UserIsGuest()) { int? customerID = _customerManager.GetCustomerId(); if (customerID.HasValue) { var rentalOrder = new RentalOrder { CustomerID = customerID.Value, RentalStartDate = DateTime.Now, RentalEndDate = DateTime.Now.AddDays(7), TotalCost = _rentalOrderManager.CalculateTotalCost(Cart), Status = OrderStatus.Pending, StartTime = TimeSpan.FromHours(8), EndTime = TimeSpan.FromHours(18) }; int orderId = _rentalOrderManager.PlaceOrder(Cart, rentalOrder); return RedirectToPage("/OrderConfirmation", new { orderId }); } }
return Page(); } catch (Exception ex) { _logger.LogError(ex, "An error occurred in OnPostPlaceOrder method"); return RedirectToPage("/Error"); } } public IActionResult OnPostRemoveFromCart(int ItemID) { _cartManager.RemoveItemFromCart(Cart, ItemID); return RedirectToPage("/Cart"); } } } ----------------------- <form method="post" asp-page-handler="PlaceOrder"> <button type="submit" class="btn btn-primary">Place Order</button> </form>
7 replies
CC#
Created by . on 6/8/2023 in #help
❔ Total price on page doesn't get updated after discount gets applied, why?
Help me please
4 replies