/// <summary> /// the user gets to select a movie and check whether its available or not, if not the user gets to choose a new date yyyy-MM-dd /// </summary> /// <param name="member">the member to borrow the movie</param> public static void BorrowAMovie(Member member) { Movie movie = SelectMovieById.SelectMovie("lend"); if (movie != null && member != null) { DateTime startDate = DateTime.Today; bool newDate = true; while (newDate) { DateTime endDate = startDate.AddMonths(1); int result = CheckLoansToCopies.Movie(movie.Id, movie.NumberOfCopies, startDate, endDate); if (result > 0) { LoanProcessAvailableMovies(member, movie, startDate, endDate); newDate = false; } else { StandardMessages.OutOfCopies(); string input = Console.ReadLine(); if (input == "0") { newDate = false; } else { startDate = SelectNewLoanDate.SelectNewDateMovie(movie.Id); } } } } }
/// <summary> /// the user gets to select a book and check whether its available or not, if not the user gets to choose a new date yyyy-MM-dd /// </summary> /// <param name="member">the member to borrow the book</param> public static void BorrowABook(Member member) { Book book = SelectBookById.SelectBook("lend"); if (book != null && member != null) { DateTime startDate = DateTime.Today; bool newDate = true; while (newDate) { DateTime endDate = startDate.AddMonths(1); int availableBooks = CheckLoansToCopies.Book(book.Id, book.NumberOfCopies, startDate, endDate); if (availableBooks > 0) { LoanProcessAvailableBooks(member, book, startDate, endDate); newDate = false; } else { StandardMessages.OutOfCopies(); string input = Console.ReadLine(); if (input == "0") { newDate = false; } else { startDate = SelectNewLoanDate.SelectNewDateBook(book.Id); } } } } }