// GET: Phim public ActionResult Index() { var cinemaId = (Session["Cinema"] as Cinema).CinemaId; ViewBag.Cinema = cinemaService.GetAll().ToList(); ViewBag.Date = listDate.ToList(); List <Showtime> lstShowtime = showtimeService.GetAll().Where(n => n.Room.Cinema.CinemaId == cinemaId).ToList(); List <Showtime> lstAvailableShowTime = new List <Showtime>(); List <Showtime> lstNotAvailableShowTime = new List <Showtime>(); List <Film> lstShowingFilm = new List <Film>(); List <Film> lstNotShowFilm = new List <Film>(); List <Film> lstAllFilm = filmService.GetAll().ToList(); foreach (DateTime item in listDate) { foreach (var st in lstShowtime) { if (st.ShowDate.ToString().Contains(item.ToString("d")) == true) { lstAvailableShowTime.Add(st); } if (item.AddDays(7).ToString().Contains(st.ShowDate?.ToString("d")) == true) { lstNotAvailableShowTime.Add(st); } } } foreach (var st in lstAvailableShowTime) { foreach (var film in lstAllFilm) { if (lstAvailableShowTime.FirstOrDefault(r => r.FilmId == film.FilmId) != null && lstShowingFilm.Contains(film) == false) { lstShowingFilm.Add(film); } } } foreach (var st in lstNotAvailableShowTime) { foreach (var film in lstAllFilm) { if (lstNotAvailableShowTime.FirstOrDefault(r => r.FilmId == film.FilmId) != null && lstNotShowFilm.Contains(film) == false) { lstNotShowFilm.Add(film); } } } ViewBag.NotShowFilm = lstNotShowFilm; return(View(lstShowingFilm.ToList())); }
// GET: Admin/Showtime public ActionResult Index() { var result = Authenticate(); if (result == 1) { return(View(showtimeService.GetAll())); } else { return(View("Error404")); } }
public ActionResult CinemaJourney(int customerId) { var tickets = ticketService.GetAll().Where(r => r.CustomerId == customerId).ToList(); List <Showtime> lstShowtime = new List <Showtime>(); foreach (var item in tickets) { var showtime = showtimeService.GetShowtime(item.ShowtimeId); if (lstShowtime.Contains(showtime) == false) { lstShowtime.Add(showtime); } } var seats = from t in ticketService.GetAll() join s in showtimeService.GetAll() on t.ShowtimeId equals s.ShowtimeId where t.CustomerId == customerId select t.Seat; ViewBag.Ticket = tickets; ViewBag.Seat = seats.ToList(); return(PartialView("_CinemaJourney", lstShowtime)); }
public ActionResult Index() { DateTime currentDate = DateTime.Now; List <DateTime> listDate = new List <DateTime>() { currentDate, currentDate.AddDays(1), currentDate.AddDays(2), currentDate.AddDays(3), currentDate.AddDays(4) }; ViewBag.Date = listDate.ToList(); ViewBag.Film = filmService.GetAll(); ViewBag.Showtime = showtimeService.GetAll(); ViewBag.Room = roomService.GetAll(); ViewBag.Seat = seatService.GetAll(); return(View()); }
public ActionResult Edit(int id) { ViewBag.Showtime = showtimeService.GetAll().ToList(); ViewBag.Seat = seatService.GetAll().ToList(); ViewBag.Customer = customerService.GetAll().ToList(); var result = Authenticate(); if (result == 1) { Ticket ticket = ticketService.GetTicket(id); return(View(ticket)); } else { return(View("Error404")); } }
// GET: Booking public ActionResult Index(int showtimeId) { Session["CurrentUrl"] = Request.Url; if (Session["Customer"] == null) { return(RedirectToAction("Index", "Login")); } else { var roomId = showtimeService.GetShowtime(showtimeId).RoomId; var seatVM = new SeatViewModel() { SeatModel = seatService.GetAll().Where(n => n.RoomId == roomId).ToList() }; ViewBag.MaxColumn = seatService.GetAll().Max(c => Convert.ToInt32(c.ColumnSeat)).ToString(); ViewBag.Showtime = showtimeService.GetAll().Where(n => n.ShowtimeId == showtimeId).ToList(); ViewBag.ShowtimeId = showtimeId; return(View(seatVM)); } }