예제 #1
0
        public bool PutLoan(Loan Loan)
        {
            if (LoanExists(Loan.LoanId))
            {
                //update the Loan data corresponding to the id
                _context.Loans.Update(Loan);
            }
            else
            {
                return(false);
            }
            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(true);
        }
예제 #2
0
        public bool PutBook(Book Book)
        {
            if (BookExists(Book.BookId))
            {
                //update the book data corresponding to the id
                _context.Books.Update(Book);
            }
            else
            {
                return(false);
            }
            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(true);
        }
예제 #3
0
        public bool PutOrder(Order Order)
        {
            if (OrderExists(Order.OrderId))
            {
                //update the Order data corresponding to the id
                _context.Orders.Update(Order);
            }
            else
            {
                return(false);
            }
            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(true);
        }
예제 #4
0
        public bool PutUsers(Users users)
        {
            //next line of code checks whether the data exists for the given id
            if (UsersExists(users.UserId))
            {
                ////update the user data corresponding to the id
                _context.Users.Update(users);
            }
            else
            {
                return(false);
            }
            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                throw;
            }

            return(true);
        }