Ejemplo n.º 1
0
 /// <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;
     }
 }
Ejemplo n.º 2
0
        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);
        }