Пример #1
0
        // GET: BookController/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.List().ToList(),
            };

            return(View(viewModel));
        }
Пример #2
0
        List <Author> fillSelectList()
        {
            var authors = authorRepository.List().ToList();

            authors.Insert(0, new Author()
            {
                Id = -1, FullName = "--- Please select an author ---"
            });
            return(authors);
        }
Пример #3
0
        // GET: Author
        public ActionResult Index()
        {
            var authors = authorRepositry.List();

            return(View(authors));
        }
Пример #4
0
        // GET: BookController
        public ActionResult Index()
        {
            var books = bookRepository.List();

            return(View(books));
        }
Пример #5
0
        // GET: AutherController
        public ActionResult Index()
        {
            var auther = autherRepository.List();

            return(View(auther));
        }
Пример #6
0
        // GET: Book
        public ActionResult Index()
        {
            var books = bookstore.List();

            return(View(books));
        }