_listA.AddFrom(_listB, item);
public void AddFrom(ListType list, ItemType item) { ItemMover.DoMove(this, list, item); }
[Serializable] internal class ItemMover : CommandBase { // declare id key value properties here public static void DoMove( ListType fromList, ListType toList, ItemType item) { var cmd = new ItemMover { FromListId = fromList.Id, ToListId = toList.Id, ItemId = item.Id }; DataPortal.Execute(cmd); // we get here because the server update worked fromList.RemoveMovedItem(item); toList.AddMovedItem(item); } protected override void DataPortal_Execute() { // update database to reflect change by using // the id key value properties // throw exception if this can't be done } }
internal void RemoveMovedItem(ItemType item) { IsReadOnly = false; try { this.Remove(item); } finally { IsReadOnly = true; } }