private void OnAddPriceListItemCommand() { var currentGoods = PriceListItems.Select(x => x.Good); var goods = Goods.Except(currentGoods); if (goods == null || goods.Count() == 0) { return; } UpdatePriceListItems(goods); }
private void UpdatePriceListItems(IEnumerable <Good> goods) { NewPriceListItems = new ObservableCollection <PriceListItem>(); foreach (Good good in goods) { PriceListItem newPriceListItem = new PriceListItem() { Good = good, GoodId = good.Id, PriceListId = Entity.Id, }; PriceListItems.Add(newPriceListItem); if (ActionType == ActionType.Edit) { NewPriceListItems.Add(newPriceListItem); } } }