/// <summary> /// 插入图书信息 /// </summary> /// <param name="book"></param> /// <returns></returns> public bool AddBook(Book book) { PMLibEntities pme = new PMLibEntities(); try { pme.Book.Add(book); return true; } catch { return false; } }
public ActionResult Create(Book book) { if (ModelState.IsValid) { try { db.Book.Add(book); db.SaveChanges(); } catch { } return RedirectToAction("Index"); } ViewBag.bkISBN = new SelectList(db.BK, "bkISBN", "bkName", book.bkISBN); return View(book); }