public ActionResult Index(BookSearchViewModel bookSearchViewModel) { ViewBag.Message = "Książki"; var libraryClient = new LibrarySoapClient(); var bookTitle = bookSearchViewModel.BookTitle ?? ""; bookSearchViewModel.Books = libraryClient.GetBooks(bookTitle); libraryClient.Close(); return(View(bookSearchViewModel)); }
public ActionResult YearsOfPublication(int yearOfPublication = 0) { var libraryClient = new LibrarySoapClient(); var model = new YearOfPublicationsViewModel(); model.YearsOfPublication = libraryClient.GetYearsOfPublication(); if (yearOfPublication != 0) { model.PublicatedBooks = libraryClient.GetBooks(yearOfPublication).Select(e => new BookShortInfo() { Id = e.Id, Title = e.Title }); model.SelectedYear = yearOfPublication; } libraryClient.Close(); return(View(model)); }