public void SelectDeselectAll() { bool allSelected = LentBooks.All(b => b.IsReturned); LentBooks.ForEach(lb => lb.IsReturned = !allSelected); RefreshCheckboxes(); }
public void Save() { using (var dbService = _dbServiceManager.GetService()) { //update only that lendings, which have changed Dictionary <int, bool> ids = new Dictionary <int, bool>(); LentBooks.Where(b => b.IsReturnedChanged).ForEach(l => ids.Add(l.Id, l.IsReturned)); if (ids.Count == 0) { TryClose(false); } else { dbService.Lendings.ReturnBooks(ids, LentBooks[0].LendingId); TryClose(true); } } }