diff --git a/.version b/.version index 2470470..bd614ad 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -1.0.4.5 \ No newline at end of file +1.0.5.6 \ No newline at end of file diff --git a/Netina.Api/Netina.Api.csproj b/Netina.Api/Netina.Api.csproj index c2a9cbe..69aacfa 100644 --- a/Netina.Api/Netina.Api.csproj +++ b/Netina.Api/Netina.Api.csproj @@ -6,8 +6,8 @@ enable true Linux - 1.0.4.5 - 1.0.4.5 + 1.0.5.6 + 1.0.5.6 diff --git a/Netina.Api/Properties/launchSettings.json b/Netina.Api/Properties/launchSettings.json index 6e06a47..8d264f8 100644 --- a/Netina.Api/Properties/launchSettings.json +++ b/Netina.Api/Properties/launchSettings.json @@ -26,7 +26,7 @@ "ASPNETCORE_URLS": "http://+:80" }, "publishAllPorts": true, - "DockerfileRunArguments": " --network=mother -p 32780:80" + "DockerfileRunArguments": " --network=mother -p 32770:80" } }, "$schema": "http://json.schemastore.org/launchsettings.json", diff --git a/Netina.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs b/Netina.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs index 51b87ce..ba1c7ac 100644 --- a/Netina.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs +++ b/Netina.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs @@ -24,9 +24,15 @@ public class CalculateOrderDiscountCommandHandler : IRequestHandler() + .TableNoTracking + .FirstOrDefaultAsync(c => c.UserId == userId, cancellationToken); + if (customer == null) + throw new BaseApiException(ApiResultStatusCode.NotFound, "Customer not found"); + var discountedUserOrder = await _repositoryWrapper.SetRepository() .TableNoTracking - .FirstOrDefaultAsync(f => f.CustomerId == userId && f.DiscountCode == discount.Code, cancellationToken); + .FirstOrDefaultAsync(f => f.CustomerId == customer.Id && f.DiscountCode == discount.Code, cancellationToken); if (discountedUserOrder != null) throw new AppException("شما یک بار از این کد تخفیف استفاده کرده اید", ApiResultStatusCode.BadRequest); }