Esempio n. 1
0
        public async Task <ActionResult> Create()
        {
            var authors = await _httpAuthor.GetAll();

            var authosView = new List <AuthorView>();

            foreach (var a in authors)
            {
                authosView.Add(Convert(a));
            }
            var bookView = new BookView()
            {
                Year    = null,
                Authors = authosView,
            };

            return(View(bookView));
        }
Esempio n. 2
0
        // GET: AuthorsController
        public async Task <ActionResult> Index()
        {
            var authors = await _http.GetAll();

            var authorsView = new List <AuthorView>();

            if (authors != null)
            {
                foreach (var a in authors)
                {
                    authorsView.Add(Convert(a));
                }
            }
            return(View(authorsView));
        }