예제 #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 model    = new BookAuthorViewModel
            {
                Id          = book.Id,
                Title       = book.Title,
                Description = book.Description,
                AuthorId    = authorId,
                Authors     = authorRepository.List().ToList(),
                ImgUrl      = book.ImageUrl
            };

            return(View(model));
        }
예제 #2
0
        // GET: Author
        public ActionResult Index()
        {
            var author = authorRepository.List();

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

            return(View(books));
        }