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); } } }
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)))); } } }
// 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}"); } }
public void UpdateShelfBooks() { ShelfBooks = new ObservableCollection <Book>(AllBooks.Where(x => x.Shelf)); }
IEnumerable <Book> GetFilteredBooks(string filter) { return(string.IsNullOrEmpty(filter) ? AllBooks : AllBooks.Where(b => b.Name.ToLower().Contains(filter))); }