mirror of https://github.com/EasyAbp/EShop.git
47 changed files with 7974 additions and 126 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); |
|
||||
} |
|
||||
} |
|
||||
@ -0,0 +1,9 @@ |
|||||
|
namespace EasyAbp.EShop.Products.Products |
||||
|
{ |
||||
|
public class InventoryDataModel |
||||
|
{ |
||||
|
public int Inventory { get; set; } |
||||
|
|
||||
|
public long Sold { get; set; } |
||||
|
} |
||||
|
} |
||||
@ -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; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
File diff suppressed because it is too large
@ -0,0 +1,31 @@ |
|||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace EShopSample.Migrations |
||||
|
{ |
||||
|
public partial class AddedSpecifiedInventoryProviderName : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "SpecifiedInventoryProviderName", |
||||
|
table: "EShopProductsProductSkus", |
||||
|
nullable: true); |
||||
|
|
||||
|
migrationBuilder.AddColumn<string>( |
||||
|
name: "SpecifiedInventoryProviderName", |
||||
|
table: "EShopProductsProducts", |
||||
|
nullable: true); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "SpecifiedInventoryProviderName", |
||||
|
table: "EShopProductsProductSkus"); |
||||
|
|
||||
|
migrationBuilder.DropColumn( |
||||
|
name: "SpecifiedInventoryProviderName", |
||||
|
table: "EShopProductsProducts"); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
File diff suppressed because it is too large
@ -0,0 +1,27 @@ |
|||||
|
using Microsoft.EntityFrameworkCore.Migrations; |
||||
|
|
||||
|
namespace EShopSample.Migrations |
||||
|
{ |
||||
|
public partial class ChangedSoldToLong : Migration |
||||
|
{ |
||||
|
protected override void Up(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AlterColumn<long>( |
||||
|
name: "Sold", |
||||
|
table: "EShopProductsProductInventories", |
||||
|
nullable: false, |
||||
|
oldClrType: typeof(int), |
||||
|
oldType: "int"); |
||||
|
} |
||||
|
|
||||
|
protected override void Down(MigrationBuilder migrationBuilder) |
||||
|
{ |
||||
|
migrationBuilder.AlterColumn<int>( |
||||
|
name: "Sold", |
||||
|
table: "EShopProductsProductInventories", |
||||
|
type: "int", |
||||
|
nullable: false, |
||||
|
oldClrType: typeof(long)); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue