예제 #1
0
 // GET: Books/Create
 public ActionResult Create()
 {
     BookCreateViewModel newBook = new BookCreateViewModel();
     ViewBag.AllAuthors = UpdateAuthors.GetAllAuthors(db);
     ViewBag.AllGenres = UpdateGenres.GetAllGenres(db);
     return View(newBook);
 }
예제 #2
0
        public static BookCreateViewModel ToViewModel(this Book book)
        {
            BookCreateViewModel  newBook = new BookCreateViewModel();
            newBook.Title = book.Title;
            newBook.PublicationDate = book.PublicationDate;
            newBook.UniqueNumber = book.UniqueNumber;
            newBook.Author = book.Author;
            newBook.SelectedGenre = book.Genre.GenreID;
            newBook.SelectedAuthor = book.Author.AuthorID;

            //return the ViewModel
            return newBook;
        }
예제 #3
0
 // GET: TestView
 public ActionResult TestView(BookCreateViewModel book)
 {
     ViewBag.BookCreate = book;
     return View();
 }