Advertisement
MaksNew

Untitled

Feb 16th, 2022
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.10 KB | None | 0 0
  1. @using System.Text.Json;
  2. @model List<Web.Mediator.Arguments.BuyRequestArguments>
  3. @{
  4. ViewData["Title"] = "Cart";
  5. }
  6.  
  7. @section Styles {
  8. <link rel="stylesheet" href="~/css/cart.css" />
  9. }
  10. <form asp-controller="Cart" asp-action="Save">
  11. <div class="container py-3">
  12. <div class="row d-flex justify-content-center align-items-center">
  13. <div class="bg-white">
  14. <div class="row">
  15.  
  16. @*Go to shop link start*@
  17. <div class="pt-5 ">
  18. <h6 class="mb-0 pt-2 ps-5">
  19. <a asp-controller="Cars" asp-action="Index" class="text-body">
  20. <span class="link-danger"><i class="fas fa-long-arrow-alt-left me-2"></i>Back to shop</span>
  21. </a>
  22. </h6>
  23. </div>
  24. @*Go to shop link end*@
  25.  
  26. <div class="col-lg-8 pb-4">
  27. <div class="px-5 pt-3 pb-2">
  28.  
  29. @*Cart items table head start*@
  30. <div class="d-flex justify-content-between align-items-center mb-5">
  31. <h2 class="fw-bold mb-0 text-black">Shopping Cart</h2>
  32. <h4 class="mb-0 text-muted">@ViewBag.TotalCount items</h4>
  33. </div>
  34. <hr class="my-4">
  35. @*Cart items table head end*@
  36.  
  37. @*Cart items start*@
  38. @if (Model != null)
  39. @for (int i = 0; i < Model.Count; i++)
  40. {
  41. @*@await Html.PartialAsync("Partials/_CartItem")*@
  42. <div class="row mb-4 d-flex justify-content-between align-items-center">
  43. @*Product name start*@
  44. <div class="col-12 col-md-5 text-center">
  45. <a>
  46. <h6 class="text-black lg-font">@Model[i].Mark @Model[i].Model</h6>
  47. </a>
  48. </div>
  49. @*Product name end*@
  50. <div class="col-12 col-md-3 text-center">
  51. <h6 class="lg-font">$@Model[i].Price</h6>
  52. </div>
  53.  
  54. @*Count*@
  55. <input asp-for="@Model[i].Count" class="cinput" id="@i" onchange="updatePrice(@Model[i].Price, @ViewBag.TotalPrice, @i)" type="number" min="1" value="1"/>
  56.  
  57. <script>
  58. function updatePrice(thisprice, totalprice, id) {
  59. var inVal = document.getElementById(id).value;
  60. totalprice = totalprice - thisprice;
  61. document.getElementById("total").innerHTML = "$" + (inVal*thisprice + totalprice);
  62. }
  63. </script>
  64.  
  65. @*Remove cart item button start*@
  66. <div class="col-md-1 col-lg-1 col-xl-1 order-first order-md-2 text-end">
  67. <a asp-controller="Cart" asp-action="Delete" asp-route-id=@i class="link-danger" style="font-size: 1.5rem;"><i class="fas fa-times"></i></a>
  68. </div>
  69. @*Remove cart item button end*@
  70. </div>
  71. <hr class="my-4">
  72. }
  73. @*Cart items end*@
  74. </div>
  75. </div>
  76.  
  77. @*Purchase information start*@
  78. <div class="col-lg-4 bg-grey">
  79. <div class="row p-5 pt-2">
  80. <h2 class="fw-bold mb-4 mt-2">Summary</h2>
  81. <hr class="my-4">
  82. <div class="d-flex justify-content-between mb-2">
  83. <h5 class="text-uppercase">Total price</h5>
  84. <h5 id="total">$@ViewBag.TotalPrice</h5>
  85. </div>
  86.  
  87. ---------------------------САБМИТ, НО НЕ САБМИТИТ---------------------------
  88. <button type="submit" class="btn btn-danger fw-bold" style="width: 100%;" asp-route-list="@JsonSerializer.Serialize(Model)">Confirm</button>
  89. -------------------------------------------------------------------------------
  90.  
  91. </div>
  92. </div>
  93. @*Purchase information end*@
  94.  
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </form>
  100.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement