public ActionResult AddBookGenre(BookGenre bookGenre) { if (ModelState.IsValid) { db.BookGenre.Add(bookGenre); db.SaveChanges(); } return(RedirectToAction("ViewBookGenre")); }
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")); }