Browse Source

Make the OriginalPrice an optional property of ProductSku, close #10

Fix sku updating feature
pull/49/head
gdlcf88 6 years ago
parent
commit
2f70975281
  1. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductSkuDto.cs
  2. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductSkuDto.cs
  3. 4
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSku.cs
  4. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/EditModal.cshtml
  5. 5
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/EditModal.cshtml.cs
  6. 2
      modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/ViewModels/CreateEditProductSkuViewModel.cs
  7. 2407
      samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200429104048_MakeOriginalPriceNullable.Designer.cs
  8. 30
      samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200429104048_MakeOriginalPriceNullable.cs
  9. 2
      samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/EasyMallMigrationsDbContextModelSnapshot.cs

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/CreateUpdateProductSkuDto.cs

@ -10,7 +10,7 @@ namespace EasyAbp.EShop.Products.Products.Dtos
public string Currency { get; set; }
[DisplayName("ProductSkuOriginalPrice")]
public decimal OriginalPrice { get; set; }
public decimal? OriginalPrice { get; set; }
[DisplayName("ProductSkuPrice")]
public decimal Price { get; set; }

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Application.Contracts/EasyAbp/EShop/Products/Products/Dtos/ProductSkuDto.cs

@ -9,7 +9,7 @@ namespace EasyAbp.EShop.Products.Products.Dtos
public string Currency { get; set; }
public decimal OriginalPrice { get; set; }
public decimal? OriginalPrice { get; set; }
public decimal Price { get; set; }

4
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Domain/EasyAbp/EShop/Products/Products/ProductSku.cs

@ -12,7 +12,7 @@ namespace EasyAbp.EShop.Products.Products
[NotNull]
public virtual string Currency { get; protected set; }
public virtual decimal OriginalPrice { get; protected set; }
public virtual decimal? OriginalPrice { get; protected set; }
public virtual decimal Price { get; protected set; }
@ -30,7 +30,7 @@ namespace EasyAbp.EShop.Products.Products
Guid id,
[NotNull] string serializedAttributeOptionIds,
[NotNull] string currency,
decimal originalPrice,
decimal? originalPrice,
decimal price,
int inventory,
int sold,

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/EditModal.cshtml

@ -9,9 +9,9 @@
<abp-modal>
<abp-modal-header title="@L["EditProductSku"].Value"></abp-modal-header>
<abp-modal-body>
<abp-input asp-for="Id" />
<abp-input asp-for="StoreId" />
<abp-input asp-for="ProductId" />
<abp-input asp-for="ProductSkuId" />
<abp-form-content />
</abp-modal-body>
<abp-modal-footer buttons="@(AbpModalButtons.Cancel|AbpModalButtons.Save)"></abp-modal-footer>

5
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/EditModal.cshtml.cs

@ -12,10 +12,6 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.ProductSku
{
public class EditModalModel : ProductsPageModel
{
[HiddenInput]
[BindProperty(SupportsGet = true)]
public Guid Id { get; set; }
[HiddenInput]
[BindProperty(SupportsGet = true)]
public Guid StoreId { get; set; }
@ -24,6 +20,7 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.ProductSku
[BindProperty(SupportsGet = true)]
public Guid ProductId { get; set; }
[HiddenInput]
[BindProperty(SupportsGet = true)]
public Guid ProductSkuId { get; set; }

2
modules/EasyAbp.EShop.Products/src/EasyAbp.EShop.Products.Web/Pages/EShop/Products/Products/ProductSku/ViewModels/CreateEditProductSkuViewModel.cs

@ -15,7 +15,7 @@ namespace EasyAbp.EShop.Products.Web.Pages.EShop.Products.Products.ProductSku.Vi
public decimal Price { get; set; }
[Display(Name = "ProductSkuOriginalPrice")]
public decimal OriginalPrice { get; set; }
public decimal? OriginalPrice { get; set; }
[Required]
[Display(Name = "ProductSkuInventory")]

2407
samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200429104048_MakeOriginalPriceNullable.Designer.cs

File diff suppressed because it is too large

30
samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/20200429104048_MakeOriginalPriceNullable.cs

@ -0,0 +1,30 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace EasyMall.Migrations
{
public partial class MakeOriginalPriceNullable : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<decimal>(
name: "OriginalPrice",
table: "ProductsProductSkus",
type: "decimal(18,6)",
nullable: true,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<decimal>(
name: "OriginalPrice",
table: "ProductsProductSkus",
type: "decimal(18,6)",
nullable: false,
oldClrType: typeof(decimal),
oldType: "decimal(18,6)",
oldNullable: true);
}
}
}

2
samples/EasyMall/aspnet-core/src/EasyMall.EntityFrameworkCore.DbMigrations/Migrations/EasyMallMigrationsDbContextModelSnapshot.cs

@ -547,7 +547,7 @@ namespace EasyMall.Migrations
b.Property<int>("OrderMinQuantity")
.HasColumnType("int");
b.Property<decimal>("OriginalPrice")
b.Property<decimal?>("OriginalPrice")
.HasColumnType("decimal(18,6)");
b.Property<decimal>("Price")

Loading…
Cancel
Save