/// <summary> /// 插入新书目BK /// </summary> /// <param name="bk"></param> /// <returns></returns> public bool AddBK(BK bk) { PMLibEntities pme = new PMLibEntities(); try { pme.BK.Add(bk); return true; } catch { return false; } }
public ActionResult Create(BK bk) { if (ModelState.IsValid) { try { db.BK.Add(bk); db.SaveChanges(); } catch { } return RedirectToAction("Index"); } return View(bk); }
public ActionResult Edit(BK bk) { if (ModelState.IsValid) { db.Entry(bk).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } return View(bk); }