// 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, Description = book.Description, AuthorId = authorId, Authors = authorRepository.GetAllList().ToList(), ImageUrl = book.ImageUrl }; return(View(viewModel)); }
// GET: Author public ActionResult Index() { var authors = authorRepository.GetAllList(); return(View(authors)); }
// GET: Book public ActionResult Index() { var books = bookRepository.GetAllList(); return(View(books)); }