private void DisplayBooks() { LibraryService service = ServiceFactory.CreateLibraryService(); FindBooksRequest request = new FindBooksRequest(); request.All = true; FindBooksResponse response = service.FindBooks(request); rptBooks.DataSource = response.Books; rptBooks.DataBind(); FindBookTitlesRequest bookTitleRequest = new FindBookTitlesRequest(); bookTitleRequest.All = true; FindBookTitlesResponse bookTitlesResponse = service.FindBookTitles(bookTitleRequest); ddlBookTitles.DataSource = bookTitlesResponse.BookTitles; ddlBookTitles.DataTextField = "Title"; ddlBookTitles.DataValueField = "ISBN"; ddlBookTitles.DataBind(); rptBookTitles.DataSource = bookTitlesResponse.BookTitles; rptBookTitles.DataBind(); }
public FindBookTitlesResponse FindBookTitles(FindBookTitlesRequest request) { FindBookTitlesResponse response = new FindBookTitlesResponse(); IList <BookTitleView> bookTitleViews = new List <BookTitleView>(); if (request.All) { bookTitleViews = _bookTitleRepository.FindAll().ConvertToBookTitleViews(); } else { BookTitle bookTitle = _bookTitleRepository.FindBy(request.ISBN); bookTitleViews.Add(bookTitle.ConvertToBookTitleView()); } response.BookTitles = bookTitleViews; response.Success = true; return(response); }