Skip to content

Commit

Permalink
Fixed conversion of LineItem.IsGift flag
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-dudarev committed Apr 6, 2018
1 parent 8bed095 commit 089dd35
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions VirtoCommerce.OrderModule.Data/Model/LineItemEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ public virtual LineItem ToModel(LineItem lineItem)
throw new ArgumentNullException(nameof(lineItem));

lineItem.InjectFrom(this);
lineItem.IsGift = IsGift;
lineItem.Discounts = Discounts.Select(x => x.ToModel(AbstractTypeFactory<Discount>.TryCreateInstance())).ToList();
lineItem.TaxDetails = TaxDetails.Select(x => x.ToModel(AbstractTypeFactory<TaxDetail>.TryCreateInstance())).ToList();

return lineItem;
}

Expand All @@ -109,16 +111,20 @@ public virtual LineItemEntity FromModel(LineItem lineItem, PrimaryKeyResolvingMa

this.InjectFrom(lineItem);

IsGift = lineItem.IsGift ?? false;

if (lineItem.Discounts != null)
{
Discounts = new ObservableCollection<DiscountEntity>();
Discounts.AddRange(lineItem.Discounts.Select(x => AbstractTypeFactory<DiscountEntity>.TryCreateInstance().FromModel(x)));
}

if (lineItem.TaxDetails != null)
{
TaxDetails = new ObservableCollection<TaxDetailEntity>();
TaxDetails.AddRange(lineItem.TaxDetails.Select(x => AbstractTypeFactory<TaxDetailEntity>.TryCreateInstance().FromModel(x)));
}

return this;
}

Expand Down

0 comments on commit 089dd35

Please sign in to comment.