Browse Source

Updated purchase functionality

pull/46/head
Galip Tolga Erdem 5 years ago
parent
commit
3001949ff7
  1. 6
      apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml
  2. 2
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml
  3. 25
      apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml.cs
  4. 18
      apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket-widget.js

6
apps/public-web/src/EShopOnAbp.PublicWeb/Components/Basket/Default.cshtml

@ -53,7 +53,11 @@
<h3>$@Model.TotalPrice.ToString("0.00")</h3> <h3>$@Model.TotalPrice.ToString("0.00")</h3>
</div> </div>
<div class="row"> <div class="row">
<abp-button size="Large" class="basket-purchase-button" text="@L["Purchase"]" button-type="Primary"/> <form method="post">
@Html.AntiForgeryToken()
<abp-button type="submit" size="Large" class="basket-purchase-button" text="@L["Purchase"]" button-type="Primary"/>
</form>
</div> </div>
</div> </div>
</div> </div>

2
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml

@ -2,7 +2,7 @@
@using EShopOnAbp.Localization @using EShopOnAbp.Localization
@using EShopOnAbp.PublicWeb.Components.Basket @using EShopOnAbp.PublicWeb.Components.Basket
@using Microsoft.Extensions.Localization @using Microsoft.Extensions.Localization
@model EShopOnAbp.PublicWeb.Pages.Basket @model EShopOnAbp.PublicWeb.Pages.BasketModel
@section scripts { @section scripts {
<abp-script src="/client-proxies/basket-proxy.js"/> <abp-script src="/client-proxies/basket-proxy.js"/>

25
apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Basket.cshtml.cs

@ -1,11 +1,30 @@
using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Volo.Abp.AspNetCore.Mvc.UI.RazorPages;
namespace EShopOnAbp.PublicWeb.Pages; namespace EShopOnAbp.PublicWeb.Pages;
public class Basket : PageModel public class BasketModel : AbpPageModel
{ {
private readonly ILogger<BasketModel> _logger;
public BasketModel(ILogger<BasketModel> logger)
{
_logger = logger;
}
public void OnGet() public void OnGet()
{ {
}
public IActionResult OnPostAsync()
{
if (!CurrentUser.IsAuthenticated)
{
_logger.LogInformation("Redirecting to Login");
return Challenge();
}
return RedirectToPage("Payment");
} }
} }

18
apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/basket-widget.js

@ -27,15 +27,15 @@
}); });
}); });
$wrapper // $wrapper
.find('.basket-purchase-button') // .find('.basket-purchase-button')
.click(function () { // .click(function () {
eShopOnAbp.basketService.basket.purchase().then(function () { // eShopOnAbp.basketService.basket.purchase().then(function () {
widgetManager.refresh(); // widgetManager.refresh();
//
abp.notify.info("Thank you for the payment!", "Purchase completed!"); // abp.notify.info("Thank you for the payment!", "Purchase completed!");
}); // });
}); // });
}; };
return { return {

Loading…
Cancel
Save