private void ListAllAvailableMovies() { List <Movie> movies = BLLMovie.ReturnAvailableMovies(); StringBuilder sb = new StringBuilder(); sb.Append("Available Movies:"); sb.Append("<br/><br/>"); sb.Append(".............................."); sb.Append("<br/><br/>"); foreach (var movie in movies) { sb.Append(string.Format($"Title: {movie.MovieName} <br/>Director: {movie.MovieDirector} <br/>Genre: {movie.Genre.GenreName}")); sb.Append("<br/><br/>"); } sb.Append(".............................."); movieslisted.InnerHtml = sb.ToString(); }
protected void Page_Load(object sender, EventArgs e) { //return currently available movies into a dropdownlist List <Movie> availableMovies = BLLMovie.ReturnAvailableMovies(); StringBuilder sb = new StringBuilder(); sb.Append("<ul>"); foreach (var m in availableMovies) { sb.Append(string.Format($"<li>{m.MovieId}<br/>Title: {m.MovieName} <br/>Director: {m.MovieDirector} <br/>Genre: {m.Genre.GenreName} </li>")); sb.Append("<br/><br/>"); PopulateMovieDroplist(m); } ; PopulateCustomerDroplist(); sb.Append("</ul>"); sb.Append("<br/><br/>"); availablemoviesID.InnerHtml = sb.ToString(); }
public static void Run() { Console.WriteLine("1. Print all Customers"); Console.WriteLine("2. Register new customer"); Console.WriteLine("3. Print movies (and currently hired movies)"); Console.WriteLine("4. Hire Movie"); Console.WriteLine("5. Return Movie"); Console.WriteLine("6. Register New Movie"); Console.WriteLine("e. Exit application"); string choice = Console.ReadLine(); switch (choice) { case "1": PrintCustomers(); Console.ReadKey(); Console.Clear(); break; case "2": RegisterNewCustomer(); Console.ReadKey(); Console.Clear(); break; case "3": PrintMovies(); PrintRentedMovies(); Console.ReadKey(); Console.Clear(); break; case "4": #region retrieve availabla movies to hire List <Movie> availableMovies = BLLMovie.ReturnAvailableMovies(); //TODO: returning movies that should not be available Console.WriteLine("Currently available movies: "); foreach (var m in availableMovies) { Console.WriteLine(m.MovieId + " " + m.MovieName); } Console.WriteLine("Choose which movie to hire >> "); int movieToBeHiredID = int.Parse(Console.ReadLine()); Movie movieToBeHired = BLLMovie.ReturnMovieWithID(movieToBeHiredID); Console.WriteLine(movieToBeHired.MovieName + " (" + movieToBeHired.Genre.GenreName + ") was choosen"); Console.WriteLine(); #endregion #region choose who will hire the movie List <Customer> customers = BLLCustomer.ReturnAllCustomers(); foreach (var c in customers) { Console.WriteLine(c.CustomerID + " " + c.CustomerName); } Console.Write("Who is going to make the hire >> "); int customerThatsHiringID = int.Parse(Console.ReadLine()); Customer customerThatsHiring = BLLCustomer.ReturnCustomerWithID(customerThatsHiringID); #endregion BLLRentedMovie.HireMovie(customerThatsHiring, movieToBeHired); Console.WriteLine(); Console.ReadKey(); Console.Clear(); break; case "5": List <RentedMovie> rentals = BLLRentedMovie.GetRentedMovies(); //todo: foreach (var rental in rentals) { Console.WriteLine(rental.RentedID + " " + rental.Movie.MovieName + " HIRED BY: " + rental.Customer.CustomerName); } Console.Write("Which movie do you wish to return? >> "); int rentIDToReturn = int.Parse(Console.ReadLine()); bool returnSuccessfull = BLLRentedMovie.RemoveRentedMovie(rentIDToReturn); Console.WriteLine(returnSuccessfull ? "movie returned successfully" : "movie was not returned"); Console.ReadKey(); Console.Clear(); break; case "6": RegisterNewMovie(); break; case "e": userQuit = true; Console.Clear(); Console.WriteLine("Goodbye..."); break; default: Console.WriteLine("Please enter a valid command"); Console.ReadKey(); Console.Clear(); break; } }