/* 用户书本收藏夹 Begin */ public long AddFavBook(string bookCode, string userId) { if (string.IsNullOrEmpty(userId)) { throw new Exception("非法操作!"); } return(_userBookRepository.AddUserBook(bookCode, userId).Result); }
public async Task <Book> CheckoutBook(string username, int bookId) { Book book = await _bookRepository.Get(bookId); if (!book.CheckedOut) { book = book.CheckOut(username); await _repository.AddUserBook(book); } return(book); }