public async Task <Book> TrySetAvailableAsync(string id) { var book = await BookStorage.ReadByIdAsync(id); if (book.IsAvailable) { throw new InvalidOperationException("that book is already available."); } book.IsAvailable = true; await BookStorage.UpdateAsync(book); return(book); }
public async Task <Book> GetBookByIdAsync(string id) { return(await BookStorage.ReadByIdAsync(id)); }