public DateTime?BookDateRented(int id)
        {
            using (var database = new LibrarySystemProEntities())
            {
                var      allRentedBooks = new RentedBookRepository().ReadAll();
                DateTime?result         = null;

                foreach (var item in allRentedBooks)
                {
                    if (item.BookId == id)
                    {
                        result = item.DateRented;
                    }
                }

                return(result);
            }
        }
Exemple #2
0
        public bool IsBookRented(int id)
        {
            using (var database = new LibrarySystemProEntities())
            {
                //var dbBook = database.Books.FirstOrDefault(b => b.Id == id);
                var allRentedBooks = new RentedBookRepository().ReadAll();
                var result         = false;

                foreach (var book in allRentedBooks)
                {
                    if (book.BookId == id)
                    {
                        result = true;
                    }
                }

                return(result);
            }
        }