Beispiel #1
0
        public ActionResult LibraryAdd(LibraryAddModel model)
        {
            Tbl_Library library = new Tbl_Library();

            library.Library_Name = model.Name;

            db.Tbl_Library.Add(library);

            if (Convert.ToBoolean(db.SaveChanges() > 0))
            {
                return(RedirectToAction("LibraryList", "Setting"));
            }
            else
            {
                return(View());
            }
        }
Beispiel #2
0
        public ActionResult LibraryEdit(LibraryAddModel model)
        {
            Tbl_Library q = new Tbl_Library();

            q = db.Tbl_Library.Where(a => a.Library_ID == model.ID).SingleOrDefault();
            q.Library_Name = model.Name;

            db.Entry(q).State = System.Data.Entity.EntityState.Modified;

            if (Convert.ToBoolean(db.SaveChanges() > 0))
            {
                return(RedirectToAction("LibraryList", "Setting"));
            }
            else
            {
                return(View());
            }
        }