public void Add(IInvoicePosition position) { position.CheckArgument(nameof(position)); var pos = new InvoicePosition(); pos.CopyProperties(position); PositionEntities.Add(pos); }
public void Remove(IInvoicePosition position) { position.CheckArgument(nameof(position)); var pos = PositionEntities.FirstOrDefault(i => (i.Id != 0 && i.Id == position.Id) || (i.Id == 0 && i.Text != null && i.Text.Equals(position.Text))); if (pos != null) { PositionEntities.Remove(pos); } }
public void CopyProperties(IInvoice other) { other.CheckArgument(nameof(other)); other.InvoiceHead.CheckArgument(nameof(other)); other.InvoicePositions.CheckArgument(nameof(other)); HeadEntity.CopyProperties(other.InvoiceHead); PositionEntities.Clear(); foreach (var item in other.InvoicePositions) { var pos = new InvoicePosition(); pos.CopyProperties(item); PositionEntities.Add(pos); } }