示例#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,
                Description = book.Description,
                AuthorId    = authorId,
                Authors     = authorRepository.GetAllList().ToList(),
                ImageUrl    = book.ImageUrl
            };

            return(View(viewModel));
        }
示例#2
0
        // GET: Author
        public ActionResult Index()
        {
            var authors = authorRepository.GetAllList();

            return(View(authors));
        }
示例#3
0
        // GET: Book
        public ActionResult Index()
        {
            var books = bookRepository.GetAllList();

            return(View(books));
        }