Exemple #1
0
        // GET: BookController/Edit/5
        public ActionResult Edit(int id)
        {
            var book      = bookStoreRepoitory.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.List().ToList(),
                ImageUrl    = book.ImageUrl
            };

            return(View(viewModel));
        }
Exemple #2
0
        // GET: BookController
        public ActionResult Index()
        {
            var books = bookStoreRepoitory.List();

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

            return(View(authors));
        }