예제 #1
0
        public ActionResult Delete(librarymodel bookk)
        {
            Library db = new Library();

            db.Delete(bookk.BookId);
            return(RedirectToAction("books", "BOOKS"));
        }
예제 #2
0
        public ActionResult Edit(librarymodel lb)
        {
            Library libb = new Library();

            libb.Edit(lb);
            return(RedirectToAction("books", "BOOKS"));
        }
예제 #3
0
        public ActionResult search(string bookName)
        {
            Library      db    = new Library();
            librarymodel bookk = db.search(bookName);

            return(View(bookk));
        }
예제 #4
0
        public ActionResult Edit(int id)
        {
            var lb = new librarymodel();

            for (int i = 0; i < booklist.Count; i++)
            {
                if (id == booklist[i].BookId)
                {
                    lb = booklist[i];
                    break;
                }
            }
            return(View(lb));
        }
예제 #5
0
        public ActionResult Delete(int id)
        {
            librarymodel bookk = new librarymodel();
            var          count = booklist.Count();

            for (int i = 0; i < count; i++)
            {
                if (booklist[i].BookId == id)
                {
                    bookk = booklist[i];
                    break;
                }
            }
            return(View(bookk));
        }
예제 #6
0
 public ActionResult Create(librarymodel lb)
 {
     if (ModelState.IsValid)
     {
         Library libb    = new Library();
         string  message = libb.Create(lb);
         if (message == "Book added to library")
         {
             return(RedirectToAction("BOOKS"));
         }
         else
         {
             ViewBag.Bookexists = message;
         }
     }
     return(View());
 }