示例#1
0
        // GET: BookController/Edit/5
        public ActionResult Edit(int id)
        {
            var book  = bookrepository.Find(id);
            var model = new BookAuthorViewModel()
            {
                BookId      = book.Id,
                BookName    = book.Title,
                Description = book.Description,
                Authorid    = book.Author.Id,
                Authors     = authorrepository.List().ToList()
            };

            return(View(model));
        }
        List <Author> FillSelectList()
        {
            var authors = authorRepository.List().ToList();

            authors.Insert(0, new Author {
                Id = -1, FullName = "--- please select an author"
            });
            return(authors);
        }
        public ActionResult Index()
        {
            var books = bookRepository.List();

            return(View(books));
        }
        // GET: AuthorController
        public ActionResult Index()
        {
            var authors = authorrepository.List();

            return(View(authors));
        }