private void handleUpdate(Response response) { if (response is BorrowBookResponse) { BorrowBookResponse borrowBookResponse = (BorrowBookResponse)response; BookQuantityDTO bookQuantityDto = borrowBookResponse.BookQuantityDto; client.bookUpdated(bookQuantityDto.BookId, bookQuantityDto.NewQuantity); } if (response is ReturnBookResponse) { ReturnBookResponse returnBookResponse = (ReturnBookResponse)response; BookDTO bookDto = returnBookResponse.BookDto; client.bookReturned(bookDto.Id, bookDto.Author, bookDto.Title); } }
public void bookUpdated(int bookId, int newQuantity) { BookQuantityDTO bookQuantityDto = new BookQuantityDTO(bookId, newQuantity); sendResponse(new BorrowBookResponse(bookQuantityDto)); }
public BorrowBookResponse(BookQuantityDTO bookQuantityDto) { this.bookQuantityDto = bookQuantityDto; }