public async Task <ActionResult> Create([FromForm] string title, string ISBN, int year, IEnumerable <string> Authors) { var authors = new List <AuthorView>(); foreach (var id in Authors) { var a = await _httpAuthor.Get(Guid.Parse(id)); var av = Convert(a); if (a != null) { authors.Add(av); } } var bv = new BookView() { Title = title, ISBN = ISBN, Year = year, Authors = authors, }; try { var author = await _http.Create(ConvertBook(bv)); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
// GET: AuthorsController/Details/5 public async Task <ActionResult> Details(Guid id) { var author = await _http.Get(id); var authorView = Convert(author); return(View(authorView)); }