diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml new file mode 100644 index 00000000..2d290799 --- /dev/null +++ b/.github/workflows/dotnet.yml @@ -0,0 +1,25 @@ +name: .NET + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: dotnet test --no-build --verbosity normal diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/UserOrders/Default.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/UserOrders/Default.cshtml index ecb4e0f5..e426ef10 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Components/UserOrders/Default.cshtml +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Components/UserOrders/Default.cshtml @@ -6,13 +6,16 @@ @model EShopOnAbp.PublicWeb.Components.UserOrders.UserOrderWidgetViewComponent.UserOrderViewModel @inject IStringLocalizer L @inject IOptions options + @if (Model.ServiceError) {
SERVICE ERROR
} + @L["UserOrders:TotalOrderCount"] @Model.UserOrders.Count + @foreach (var order in Model.UserOrders) { var orderTotalString = order.Items.Sum(q => q.UnitPrice * q.Units).ToString("C", new CultureInfo("en-US")); @@ -51,24 +54,32 @@ - @{ - string imageUrl = $"{options.Value.RemoteServices.Default.BaseUrl}product-images/{item.PictureUrl}"; - - } + + @{ + string imageUrl = $"{options.Value.RemoteServices.Default.BaseUrl}product-images/{item.PictureUrl}"; + + } + - -
@item.ProductName
-
@L["UserOrders:ProductReturnDate"] @order.OrderDate.AddMonths(1).ToString("dd MMMM yyyy")
+ + +
@item.ProductName
+
@L["UserOrders:ProductReturnDate"] @order.OrderDate.AddMonths(1).ToString("dd MMMM yyyy")
+
- @L["UserOrders:ReturnProducts"] + + @L["UserOrders:ReturnProducts"] + - @L["UserOrders:AddReview"] + + @L["UserOrders:AddReview"] +
diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbp.PublicWeb.csproj b/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbp.PublicWeb.csproj index ee687dbb..342de04c 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbp.PublicWeb.csproj +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbp.PublicWeb.csproj @@ -6,6 +6,7 @@ + diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs b/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs index 706e7ee2..a5dff1ac 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs @@ -20,6 +20,7 @@ using StackExchange.Redis; using System; using System.Net.Http.Headers; using Microsoft.AspNetCore.HttpOverrides; +using Polly; using Volo.Abp; using Volo.Abp.Account; using Volo.Abp.AspNetCore.Authentication.OpenIdConnect; @@ -74,6 +75,19 @@ public class EShopOnAbpPublicWebModule : AbpModule typeof(EShopOnAbpPublicWebModule).Assembly ); }); + + PreConfigure(options => + { + options.ProxyClientBuildActions.Add((remoteServiceName, clientBuilder) => + { + clientBuilder.AddTransientHttpErrorPolicy(policyBuilder => + policyBuilder.WaitAndRetryAsync( + 3, + i => TimeSpan.FromSeconds(Math.Pow(2, i)) + ) + ); + }); + }); } public override void ConfigureServices(ServiceConfigurationContext context) diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Index.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Index.cshtml index e19737e6..24b58a5d 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Index.cshtml +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Index.cshtml @@ -14,12 +14,12 @@ } @section styles{ - + } @section scripts { - - + + } @if (Model.HasRemoteServiceError) @@ -44,13 +44,15 @@ string productImage = !product.ImageName.IsNullOrEmpty() ? $"{options.Value.RemoteServices.Default.BaseUrl}product-images/{product.ImageName}" : $"{options.Value.RemoteServices.Default.BaseUrl}product-images/@product.ImageName"; string buyText = L["Index:AddToBasket"];
-
-
-
@product.Name
- @product.Code - @L["StockCount"]: @product.StockCount + +
+
+
@product.Name
+ @product.Code - @L["StockCount"]: @product.StockCount +
-
- + +
@if (product.StockCount > 0) { diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/ProductDetail.cshtml b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/ProductDetail.cshtml new file mode 100644 index 00000000..d9876bda --- /dev/null +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/ProductDetail.cshtml @@ -0,0 +1,55 @@ +@page "/products/{id:guid}" +@using EShopOnAbp.Localization +@using Microsoft.Extensions.Localization +@using System.Globalization +@using Microsoft.Extensions.Options +@using Volo.Abp.Http.Client +@model EShopOnAbp.PublicWeb.Pages.ProductDetailModel +@inject IStringLocalizer L +@inject IOptions options + +@section styles{ + +} + +@section scripts { + + +} + +
+
+
+
+ @{ + var product = Model.Product; + var productPrice = product.Price.ToString("C", new CultureInfo("en-US")); + string productImage = !product.ImageName.IsNullOrEmpty() ? $"{options.Value.RemoteServices.Default.BaseUrl}product-images/{product.ImageName}" : $"{options.Value.RemoteServices.Default.BaseUrl}product-images/@product.ImageName"; + string buyText = L["Index:AddToBasket"]; +
+
+
+
@product.Name
+ @product.Code - @L["StockCount"]: @product.StockCount +
+
+ +
+ @if (product.StockCount > 0) + { + + } + else + { + + } +
+ @productPrice +
+
+
+ } +
+
+
+
\ No newline at end of file diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/ProductDetail.cshtml.cs b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/ProductDetail.cshtml.cs new file mode 100644 index 00000000..99ad7431 --- /dev/null +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/ProductDetail.cshtml.cs @@ -0,0 +1,28 @@ +using EShopOnAbp.CatalogService.Products; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace EShopOnAbp.PublicWeb.Pages +{ + public class ProductDetailModel : AbpPageModel + { + [BindProperty(SupportsGet = true)] + public int OrderNo { get; set; } + + public ProductDto Product { get; private set; } + + private readonly IPublicProductAppService _productAppService; + + public ProductDetailModel(IPublicProductAppService productAppService) + { + _productAppService = productAppService; + } + + public async Task OnGet(Guid id) + { + Product = await _productAppService.GetAsync(id); + } + } +} \ No newline at end of file diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/index.css b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/index.css index fea3c70f..9b2c3929 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/index.css +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/Pages/index.css @@ -2,6 +2,11 @@ background-color: #f9f9f9; } +a, a:hover, a:visited, a:active { + color: inherit; + text-decoration: none; +} + .product-list-item { background-color: #fff; padding: 2em; diff --git a/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/user-orders/user-order-widget.css b/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/user-orders/user-order-widget.css index e69de29b..bfa23e93 100644 --- a/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/user-orders/user-order-widget.css +++ b/apps/public-web/src/EShopOnAbp.PublicWeb/wwwroot/components/user-orders/user-order-widget.css @@ -0,0 +1,4 @@ +a, a:hover, a:visited, a:active { + color: inherit; + text-decoration: none; +}