// GET: BookController/Edit/5 public ActionResult Edit(int id) { var book = bookStoreRepoitory.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.List().ToList(), ImageUrl = book.ImageUrl }; return(View(viewModel)); }
// GET: BookController public ActionResult Index() { var books = bookStoreRepoitory.List(); return(View(books)); }
// GET: Author public ActionResult Index() { var authors = authorRepository.List(); return(View(authors)); }