// GET: BookController/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.List().ToList(), }; return(View(viewModel)); }
List <Author> fillSelectList() { var authors = authorRepository.List().ToList(); authors.Insert(0, new Author() { Id = -1, FullName = "--- Please select an author ---" }); return(authors); }
// GET: Author public ActionResult Index() { var authors = authorRepositry.List(); return(View(authors)); }
// GET: BookController public ActionResult Index() { var books = bookRepository.List(); return(View(books)); }
// GET: AutherController public ActionResult Index() { var auther = autherRepository.List(); return(View(auther)); }
// GET: Book public ActionResult Index() { var books = bookstore.List(); return(View(books)); }