Пример #1
0
        public override void SwitchEditableStateExecute()
        {
            base.SwitchEditableStateExecute();

            InitializeBookCollection();

            void InitializeBookCollection()
            {
                if (!Books.Any())
                {
                    var tempBookCollection = AllBooks.Where(item => !SelectedItem.Model.BooksSeries
                                                            .Any(x => x.SeriesId == SelectedItem.Id && x.BookId == item.Id))
                                             .OrderBy(b => b.DisplayMember);

                    PopulateBooksCollection(tempBookCollection);
                }
            }
        }
Пример #2
0
        public void SearchBook(ActionExecutionContext context, string phrase)
        {
            SearchPhrase = phrase;

            var keyArgs = context.EventArgs as KeyEventArgs;

            if (keyArgs != null && keyArgs.Key == Key.Enter)
            {
                if (String.IsNullOrEmpty(phrase))
                {
                    Books = new BindableCollection <Book>(AllBooks);
                }
                else
                {
                    Books = new BindableCollection <Book>(AllBooks.Where(c => c.Title.ContainsAny(phrase) || (!String.IsNullOrEmpty(c.AuthorsString) && c.AuthorsString.ContainsAny(phrase))));
                }
            }
        }
Пример #3
0
        // wypisz zarezerwowane ksiązki
        private static void Query1()
        {
            var listOfReservationBook = new List <Book>();

            AllReservation.ForEach(p =>
            {
                var reservedBooks = AllBooks.Where(a => a.Id == p.BookNumber).Select(b => b);

                foreach (var book in reservedBooks)
                {
                    listOfReservationBook.Add(book);
                }
            });

            foreach (var book in listOfReservationBook)
            {
                Console.WriteLine($"Nazwa: {book.Name}");
            }
        }
Пример #4
0
 public void UpdateShelfBooks()
 {
     ShelfBooks = new ObservableCollection <Book>(AllBooks.Where(x => x.Shelf));
 }
Пример #5
0
 IEnumerable <Book> GetFilteredBooks(string filter)
 {
     return(string.IsNullOrEmpty(filter) ? AllBooks : AllBooks.Where(b => b.Name.ToLower().Contains(filter)));
 }