Ejemplo n.º 1
0
        public void SelectDeselectAll()
        {
            bool allSelected = LentBooks.All(b => b.IsReturned);

            LentBooks.ForEach(lb => lb.IsReturned = !allSelected);
            RefreshCheckboxes();
        }
Ejemplo n.º 2
0
        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);
                }
            }
        }