Пример #1
0
        /// <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;
            }
        }
Пример #2
0
        public ActionResult Create(BK bk)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    db.BK.Add(bk);
                    db.SaveChanges();
                }
                catch { }

                return RedirectToAction("Index");
            }

            return View(bk);
        }
Пример #3
0
 public ActionResult Edit(BK bk)
 {
     if (ModelState.IsValid)
     {
         db.Entry(bk).State = EntityState.Modified;
         db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(bk);
 }