/// <summary> /// Remove items from the locally tracked inventory /// </summary> /// <param name="items"></param> /// <returns></returns> public VMInventory Remove(List <Item> items) { VMItems.RemoveAll(x => items.Select(y => y.Id).ToList().Contains(x.Id)); Items.RemoveAll(x => items.Select(y => y.Id).ToList().Contains(x.Id)); Items = Items.ToList(); VMItems = VMItems.ToList(); return(this); }
/// <summary> /// Add items to the locally tracked inventory /// </summary> /// <param name="items"></param> /// <returns></returns> public VMInventory Add(List <Item> items) { items.ForEach(item => { Items.Add(item); VMItems.Add(new VMInventoryItem() { Id = item.Id, Name = item.GetProperty <VisibleItemProperty>()?.Name ?? "** Unknown **" }); }); Items = Items.ToList(); VMItems = VMItems.ToList(); return(this); }