mirror of https://github.com/EasyAbp/EShop.git
6 changed files with 16 additions and 42 deletions
@ -1,11 +0,0 @@ |
|||||
using System; |
|
||||
using System.Threading.Tasks; |
|
||||
using Volo.Abp.Domain.Services; |
|
||||
|
|
||||
namespace EasyAbp.EShop.Products.Products |
|
||||
{ |
|
||||
public interface IProductDiscountManager : IDomainService |
|
||||
{ |
|
||||
Task<decimal> GetDiscountedPriceAsync(Product product, ProductSku productSku, Guid storeId); |
|
||||
} |
|
||||
} |
|
||||
@ -1,22 +0,0 @@ |
|||||
using System; |
|
||||
using System.Threading.Tasks; |
|
||||
using Microsoft.Extensions.DependencyInjection; |
|
||||
using Volo.Abp.Domain.Services; |
|
||||
|
|
||||
namespace EasyAbp.EShop.Products.Products |
|
||||
{ |
|
||||
public class ProductDiscountManager : DomainService, IProductDiscountManager |
|
||||
{ |
|
||||
public async Task<decimal> GetDiscountedPriceAsync(Product product, ProductSku productSku, Guid storeId) |
|
||||
{ |
|
||||
var currentPrice = productSku.Price; |
|
||||
|
|
||||
foreach (var provider in ServiceProvider.GetServices<IProductDiscountProvider>()) |
|
||||
{ |
|
||||
currentPrice = await provider.GetDiscountedPriceAsync(product, productSku, storeId, currentPrice); |
|
||||
} |
|
||||
|
|
||||
return currentPrice; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue