Example #1
0
        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());
        }
Example #2
0
 // 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));
     }
 }
Example #3
0
        // GET: Admin/Seat
        public ActionResult Index(int?page)
        {
            var result = Authenticate();

            if (result == 1)
            {
                int pageSize   = 126;
                int pageNumber = (page ?? 1);
                return(View(seatService.GetAll().ToPagedList(pageNumber, pageSize)));
            }
            else
            {
                return(View("Error404"));
            }
        }
Example #4
0
        public ActionResult GetShowtimeByShowDate(string showDate, int id, int cinemaId)
        {
            Dictionary <int, int> lstSeats = new Dictionary <int, int>();
            DateTime currentDate           = DateTime.Now;
            Film     film = filmService.GetFilm(id);

            DateTime        date          = DateTime.Parse(showDate);
            List <Showtime> listShowtimes = showtimeService.GetAll().Where(a => a.ShowDate == date && a.FilmId == film.FilmId && a.Room.CinemaId == cinemaId).OrderBy(a => a.Queue).ToList();

            foreach (var item in listShowtimes)
            {
                var seats = seatService.GetAll().Where(n => n.RoomId == item.RoomId).Count() - ticketService.GetAll().Where(n => n.ShowtimeId == item.ShowtimeId).Count();
                lstSeats.Add(item.ShowtimeId, seats);
            }
            ViewBag.Seat = lstSeats;
            return(PartialView("_GetShowtimeByShowDate", listShowtimes));
        }
Example #5
0
        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"));
            }
        }