private void LoadBook(object sender, BookInfoEvent bookInfo) { if (bookInfo.BookId == 0) { Book = new Book(); } else { Book = _booksService.GetBook(bookInfo.BookId); } }
private void LoadBook(object sender, BookInfoEvent bookInfo) { if (bookInfo.BookId == 0) { int bookId = _booksService.Books.Select(b => b.BookId).Max() + 1; Book = new Book(bookId); } else { Book = _booksService.GetBook(bookInfo.BookId); } }
private void LoadBook(object sender, BookInfoEvent bookInfo) => Book = bookInfo.BookId == 0 ? new Book() : _booksService.GetBook(bookInfo.BookId);