protected override void Edit() { int id = _ui.ReadInt("Book ID", 0); Book book = _bookDao.Get(id); if (book == null) { _ui.PrintLn("Book not found"); return; } _ui.PrintLn(book); _ui.PrintLn("Authors:"); foreach (var a in _authorDao.GetAll()) { _ui.PrintLn(a); } int authorId = _ui.ReadInt("Author ID", book.Author.Id); string title = _ui.ReadString("Title", book.Title); Author author = _authorDao.Get(authorId); if (author == null) { _ui.PrintLn("Author not found"); return; } book.Author = author; book.Title = title; _bookDao.Update(book); }
public async Task <Book> GetBook(int id) { return(await bookDao.Get(id).ConfigureAwait(false)); }
public Book Get(int id) { return(_bookDao.Get(id)); }