Esempio n. 1
0
 public ActionResult AddBookGenre(BookGenre bookGenre)
 {
     if (ModelState.IsValid)
     {
         db.BookGenre.Add(bookGenre);
         db.SaveChanges();
     }
     return(RedirectToAction("ViewBookGenre"));
 }
Esempio n. 2
0
 public ActionResult AddBook(Book book)
 {
     if (ModelState.IsValid)
     {
         db.Book.Add(book);
         db.SaveChanges();
     }
     ViewBag.BookGenreId = new SelectList(db.BookGenre, "BookGenreId", "BookGenreName", book.BookGenreId);
     return(RedirectToAction("ViewBook"));
 }