예제 #1
0
        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));
        }
예제 #2
0
        public ActionResult Authors(string author)
        {
            var libraryClient = new LibrarySoapClient();
            var model         = new AuthorsViewModel();

            model.Authors = libraryClient.GetAuthors();
            if (!string.IsNullOrWhiteSpace(author))
            {
                model.PublicatedBooks =
                    libraryClient.GetBooksByAuthor(author).Select(e => new BookShortInfo()
                {
                    Id = e.Id, Title = e.Title
                });
                model.SelectedAuthor = author;
            }
            libraryClient.Close();

            return(View(model));
        }