fix calculate issue
parent
a1f2e92863
commit
cfb293c135
|
@ -6,8 +6,8 @@
|
|||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
<AssemblyVersion>1.5.17.23</AssemblyVersion>
|
||||
<FileVersion>1.5.17.23</FileVersion>
|
||||
<AssemblyVersion>1.5.17.26</AssemblyVersion>
|
||||
<FileVersion>1.5.17.26</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -72,7 +72,7 @@ public static class ServiceExtensions
|
|||
serviceCollection.AddDbContextFactory<ApplicationContext>(options =>
|
||||
{
|
||||
options.UseQueryTrackingBehavior(QueryTrackingBehavior.NoTracking);
|
||||
options.UseNpgsql(Configuration.GetConnectionString("PostgresServer"), b => b.MigrationsAssembly("Netina.Repository"))
|
||||
options.UseNpgsql(Configuration.GetConnectionString("Postgres"), b => b.MigrationsAssembly("Netina.Repository"))
|
||||
.UseProjectAssembly(typeof(ApplicationUser).Assembly);
|
||||
|
||||
//options.EnableServiceProviderCaching(true);
|
||||
|
|
|
@ -70,7 +70,7 @@ public class CalculateProductDiscountCommandHandler(IRepositoryWrapper repositor
|
|||
|
||||
if (request.DiscountPercent == 0)
|
||||
{
|
||||
request.CostWithDiscount = 0;
|
||||
request.CostWithDiscount = request.Cost;
|
||||
request.HasDiscount = false;
|
||||
}
|
||||
|
||||
|
@ -131,6 +131,12 @@ public class CalculateProductDiscountCommandHandler(IRepositoryWrapper repositor
|
|||
request.CostWithDiscount = discountPrice;
|
||||
request.DiscountPercent = request.Cost == 0 ? 0 : 100 - 100 * request.CostWithDiscount / request.Cost;
|
||||
}
|
||||
if (request.DiscountPercent == 0)
|
||||
{
|
||||
request.CostWithDiscount = request.Cost;
|
||||
request.HasDiscount = false;
|
||||
}
|
||||
|
||||
|
||||
return request;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ public partial class Order
|
|||
}
|
||||
else
|
||||
{
|
||||
orderProduct.SetCount(count);
|
||||
orderProduct.SetCount(count,cost,costWithDiscount,packingCost);
|
||||
}
|
||||
}
|
||||
public void RemoveFromOrderBag(Guid productId, int count)
|
||||
|
@ -175,7 +175,14 @@ public partial class OrderProduct
|
|||
public void SetCount(int count)
|
||||
{
|
||||
Count = count;
|
||||
var productCost = ProductFeeWithDiscount * Count;
|
||||
}
|
||||
public void SetCount(int count,double productFee,double costWithDiscount,double packingFee)
|
||||
{
|
||||
Count = count;
|
||||
ProductFee = productFee;
|
||||
PackingFee = packingFee;
|
||||
ProductFeeWithDiscount = costWithDiscount;
|
||||
ProductCost = ProductFeeWithDiscount * Count;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue