예제 #1
0
        public ActionResult Create([Bind(Include = "BookID,BookName,BookGenre,BookYear")] BookInfo bookInfo)
        {
            if (ModelState.IsValid)
            {
                db.BookInfoes.Add(bookInfo);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(bookInfo));
        }
예제 #2
0
        public ActionResult Create([Bind(Include = "CUSTOMERID,FirstName,Surname,TelephoneNumber,EmailAddress,Username,Password")] Customer customer)
        {
            if (ModelState.IsValid)
            {
                db.Customers.Add(customer);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(customer));
        }
예제 #3
0
        public ActionResult Create([Bind(Include = "BookID,ISBN,Title,Author,Barcode")] Books1 books1)
        {
            if (ModelState.IsValid)
            {
                db.Books1.Add(books1);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(books1));
        }
예제 #4
0
        public ActionResult Create([Bind(Include = "AuthorID,FirstName,MiddleName,Surname,DateOfBirth,PlaceOfBirth")] Author author)
        {
            if (ModelState.IsValid)
            {
                db.Authors.Add(author);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(author));
        }
예제 #5
0
        public ActionResult Create([Bind(Include = "BorrowerID,FirstName,MiddleName,LastName,DateOfBirth")] Borrower borrower)
        {
            if (ModelState.IsValid)
            {
                db.Borrowers.Add(borrower);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.BorrowerID = new SelectList(db.Borrows, "BorrowID", "BorrowID", borrower.BorrowerID);
            return(View(borrower));
        }
예제 #6
0
        public ActionResult Create([Bind(Include = "BorrowID,BorrowDate,BorrowReturn")] Borrow borrow)
        {
            if (ModelState.IsValid)
            {
                db.Borrows.Add(borrow);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.BorrowID = new SelectList(db.Borrowers, "BorrowerID", "FirstName", borrow.BorrowID);
            return(View(borrow));
        }
예제 #7
0
        public ActionResult Create([Bind(Include = "BookCopyID,CustomerID,ReturnDate,BookID")] BookCopy bookCopy)
        {
            if (ModelState.IsValid)
            {
                db.BookCopies.Add(bookCopy);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.CustomerID = new SelectList(db.Customers, "CUSTOMERID", "FirstName", bookCopy.CustomerID);
            ViewBag.BookID     = new SelectList(db.Books1, "BookID", "ISBN", bookCopy.BookID);
            ViewBag.BookCopyID = new SelectList(db.BookCopies, "BookCopyID", "BookID", bookCopy.BookCopyID);
            ViewBag.BookCopyID = new SelectList(db.BookCopies, "BookCopyID", "BookID", bookCopy.BookCopyID);
            ViewBag.BookID     = new SelectList(db.Books1, "BookID", "ISBN", bookCopy.BookID);
            return(View(bookCopy));
        }