diff --git a/Nop.Plugin.Api/Controllers/ProductsController.cs b/Nop.Plugin.Api/Controllers/ProductsController.cs index 8b1914e..f38a7df 100644 --- a/Nop.Plugin.Api/Controllers/ProductsController.cs +++ b/Nop.Plugin.Api/Controllers/ProductsController.cs @@ -536,14 +536,14 @@ private void UpdateDiscountMappings(Product product, List passedDiscountIds if (passedDiscountIds.Contains(discount.Id)) { //new discount - if (product.AppliedDiscounts.Count(d => d.Id == discount.Id) == 0) - product.AppliedDiscounts.Add(discount); + if (product.DiscountProductMappings.Count(d => d.DiscountId == discount.Id) == 0) + product.DiscountProductMappings.Add(new DiscountProductMapping { Discount = discount }); } else { //remove discount - if (product.AppliedDiscounts.Count(d => d.Id == discount.Id) > 0) - product.AppliedDiscounts.Remove(discount); + if (product.DiscountProductMappings.Count(d => d.DiscountId == discount.Id) > 0) + product.DiscountProductMappings.Remove(product.DiscountProductMappings.FirstOrDefault(x => x.DiscountId == discount.Id)); } } @@ -606,4 +606,4 @@ private void UpdateAssociatedProducts(Product product, List passedAssociate } } } -} \ No newline at end of file +}