async Task GetDataAsync()
        {
            var authorRepo = new AuthorRepository();
            var titleRepo  = new TitleRepository();

            Task <IEnumerable <Author> > authorsTask = authorRepo.GetAuthorsAsync();
            Task <IEnumerable <Title> >  titlesTask  = titleRepo.GetTitlesAsync();

            await Task.WhenAll(authorsTask, titlesTask);

            int authorCount = authorsTask.Result.Count();
            int titleCount  = titlesTask.Result.Count();

            output.Text = (authorCount + titleCount).ToString();
        }
        public async Task <ActionResult> Full()
        {
            var authorRepo = new AuthorRepository();
            var titleRepo  = new TitleRepository();

            var authorsTask = authorRepo.GetAuthorsAsync();
            var titlesTask  = titleRepo.GetTitlesAsync();

            await Task.WhenAll(authorsTask, titlesTask);

            IEnumerable <Author> authors = authorsTask.Result;
            IEnumerable <Title>  titles  = titlesTask.Result;

            return(View("Full", new FullViewModel {
                Authors = authors, Titles = titles
            }));
        }
        // GET api/Full/

        public async Task <FullResponse> Get()
        {
            var authorRepo = new AuthorRepository();
            var titleRepo  = new TitleRepository();

            var authorTask = authorRepo.GetAuthorsAsync();
            var titleTask  = titleRepo.GetTitlesAsync();

            await Task.WhenAll(authorTask, titleTask);

            var response = new FullResponse
            {
                Authors = authorTask.Result,
                Titles  = titleTask.Result
            };

            return(response);
        }
        public async Task <FullDetails> GetAuthorsAndTitles()
        {
            var authorTask = authorRepo.GetAuthorsAsync();
            var titleTask  = titleRepo.GetTitlesAsync();

            await Task.WhenAll(authorTask, titleTask);

            var response = new FullDetails
            {
                Authors = authorTask.Result.Select(a => new AuthorDTO
                {
                    FirstName = a.FirstName,
                    LastName  = a.LastName
                }).ToList(),

                Titles = titleTask.Result.Select(t => new TitleDTO()
                {
                    Name  = t.Name,
                    Price = t.Price == 0.0m ? (decimal?)null : t.Price
                }).ToList(),
            };

            return(response);
        }