예제 #1
0
        // 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,
                Descrption = book.Description,
                AuthorId   = book.Author.id,
                Authors    = authorRepository.List().ToList()
            };

            return(View(viewModel));
        }
예제 #2
0
        // GET: Book
        public ActionResult Index()
        {
            var books = bookRepository.List();

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

            return(View(authors));
        }