Example #1
0
        public ActionResult ReturnBook(int serial)
        {
            // Query the database for the rows to be deleted.

            using (Team8LibraryContext db = new Team8LibraryContext())
            {
                var query =
                    from co in db.CheckedOut
                    select new { co.Serial, co.CardNum };

                var retBook = new CheckedOut();
                foreach (var q in query)
                {
                    System.Diagnostics.Debug.WriteLine(q);
                    if (q.Serial == (uint)serial)
                    {
                        retBook.CardNum = q.CardNum;
                        retBook.Serial  = q.Serial;
                        db.CheckedOut.Remove(retBook);
                    }
                }

                db.SaveChanges();

                return(Json(new { success = true }));
            }
        }
Example #2
0
        public ActionResult CheckOutBook(int serial)
        {
            // You may have to cast serial to a (uint)
            using (Team8LibraryContext db = new Team8LibraryContext())
            {
                CheckedOut co = new CheckedOut();
                co.CardNum = (uint)card;
                co.Serial  = (uint)serial;
                db.CheckedOut.Add(co);
                db.SaveChanges();

                return(Json(new { success = true }));
            }
        }