public void OpenWindowAuthorMethod() { if (CheckAuthor()) { if (BookOfAuthor.Count != 0) { BookOfAuthor.Clear(); } using (Model1 context = new Model1()) { ObservableCollection <Book> Books = context.Authors.Where(c => (c.SecondName == SelectedAuthor.SecondName) & (c.FatherName == SelectedAuthor.FatherName) & (c.FirstName == SelectedAuthor.FirstName)).Select(c => c.Books).FirstOrDefault(); foreach (Book b in Books) { BookOfAuthor.Add(b.BookName); } } NewAuthor = SelectedAuthor; BookName = null; WindowAuthors WindowNew = new WindowAuthors(); WindowNew.ShowDialog(); } else { MessageBox.Show("Автор не найден"); } }
public void AddBookToAuthorMethod() { BookOfAuthor.Add(BookName); if (CheckBook() == false) { AddBookMethod(); } Add(BookName, NewAuthor); }