void bAdd_Click(object sender, EventArgs e) { var book = GetSelectedBook(); book.Do(b => { AllBooks.Remove(b); AddRequest(b); }); AllBooks = AllBooks.OrderBy(b => b.Name).ToList(); gcBooks.Bind(AllBooks); }
public void DeleteBook() { if (MessageBox.Show(String.Format(App.GetString("AreYouSureRemoveBook"), SelectedBook.Title), App.GetString("Removing"), MessageBoxButton.YesNoCancel, MessageBoxImage.Warning, MessageBoxResult.Cancel) != MessageBoxResult.Yes) { return; } using (var dbService = _dbServiceManager.GetService()) { dbService.Books.Delete(SelectedBook.Id); AllBooks.Remove(SelectedBook); Books.Remove(SelectedBook); } }
public void removeBookIfExists(Book book2) { if (AllBooks.Count == 0) { return; } Book bookToRemove = null; foreach (var book in AllBooks) { if (book.Uniqe_ID.Equals(book2.Uniqe_ID)) { bookToRemove = book; } } AllBooks.Remove(bookToRemove); }
public void DeleteBookMethod() { if (CheckBook()) { using (Model1 context = new Model1()) { Book OneBook = context.Books.Where(c => c.BookName == BookName) .Include(c => c.Authors).FirstOrDefault(); context.Books.Remove(OneBook); context.SaveChanges(); } AllBooks.Remove(BookName); } else { MessageBox.Show("Книга не найдена"); } }
void DeleteBook() { AllBooks.Remove(SelectedBook); }