コード例 #1
0
        private void SaveNewAndUpdatedCopies()
        {
            foreach (var item in _itemCopiesViewModel.Values)
            {
                if (item.CopyNo == 0)    // => New Copy
                {
                    var newCopy = _item.AddCopy();
                    item.CopyNo = newCopy.CopyNo;
                }

                if (item.IsBorrowed != _item.Copies[item.CopyNo].IsBorrowed)
                {
                    if (item.IsBorrowed)
                    {
                        _item.BorrowCopy(item.CopyNo);
                    }
                    else
                    {
                        _item.ReturnCopy(item.CopyNo);
                    }

                    item.BorrowingDate   = _item.Copies[item.CopyNo].BorrowingDate;
                    item.BorrowingPeriod = _item.Copies[item.CopyNo].BorrowingPeriod;
                }
            }
        }