// GET: Book/Edit/5 public ActionResult Edit(int id) { var book = bookRepository.Find(id); var authorId = book.Author == null ? book.Author.id = 0 : book.Author.id; var viewModel = new BookAuthorViewModel { BookId = book.id, Title = book.Title, Descrption = book.Description, AuthorId = book.Author.id, Authors = authorRepository.List().ToList() }; return(View(viewModel)); }
// GET: Book public ActionResult Index() { var books = bookRepository.List(); return(View(books)); }
// GET: Author public ActionResult Index() { var authors = authorReporsitory.List(); return(View(authors)); }