예제 #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));
        }