// 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 model = new BookAuthorViewModel { Id = book.Id, Title = book.Title, Description = book.Description, AuthorId = authorId, Authors = authorRepository.List().ToList(), ImgUrl = book.ImageUrl }; return(View(model)); }
// GET: Author public ActionResult Index() { var author = authorRepository.List(); return(View(author)); }
// GET: Book public ActionResult Index() { var books = bookRepository.List(); return(View(books)); }