Exemplo n.º 1
0
        public ActionResult BookTicket(string idSeat)
        {
            /*TicketsDal dal = new TicketsDal();
             * MovieDal movieDal = new MovieDal();
             * TicketsViewModel mvm = new TicketsViewModel();
             * var item = movieDal.MOVIES.Where(a => a.ID == id).FirstOrDefault(); ;
             * List<Tickets> tickets = dal.TicketsList.ToList();
             * mvm.Tickets = new Tickets();
             * mvm.TicketsList = tickets;
             * return View(mvm);*/
            Tickets  mvm         = new Tickets();
            ItemCart itemCart    = new ItemCart();
            MovieDal dal         = new MovieDal();
            SeatDal  seatDal     = new SeatDal();
            var      itemSeat2   = seatDal.Seats.Where(a => a.IdSeat == idSeat).FirstOrDefault();
            var      itemsMovie3 = dal.MOVIES.Where(a => a.SALLE == itemSeat2.Hall && a.showtime == itemSeat2.date).FirstOrDefault();

            //var item = dal.MOVIES.Where(a => a.ID == itemsMovie3.ID).FirstOrDefault();
            //var itemSeat = seatDal.Seats.Where(a => a.IdSeat == id).FirstOrDefault();
            mvm.MOVIENAME = itemsMovie3.name;
            mvm.SHOWTIME  = itemsMovie3.showtime;
            mvm.COST      = itemsMovie3.price;
            mvm.SEAT      = itemSeat2.Number;


            return(View(mvm));
        }
Exemplo n.º 2
0
 public ActionResult Reserve(string id)
 {
     using (SeatDal dc = new SeatDal())
     {
         var v = dc.Seats.Where(a => a.IdSeat == id).FirstOrDefault();
         return(View(v));
     }
 }
Exemplo n.º 3
0
        public ActionResult SeatGalleryUser()
        {
            SeatDal dal = new SeatDal();

            if (ModelState.IsValid)
            {
                var data = dal.Seats.ToList();
                return(View());
            }
            else
            {
                return(View("Home/MovieGallery"));
            }
        }
Exemplo n.º 4
0
 public ActionResult GetListSeat()
 {
     using (SeatDal db = new SeatDal())
     {
         List <Seat> empList = new List <Seat>();
         for (int i = 0; i < db.Seats.ToList <Seat>().Count(); i++)
         {
             if (db.Seats.ToList <Seat>()[i].reserve == false)
             {
                 empList.Add(db.Seats.ToList <Seat>()[i]);
             }
         }
         return(Json(new { data = empList }, JsonRequestBehavior.AllowGet));
     }
 }
Exemplo n.º 5
0
        public ActionResult SeatGalleryUser(string id)
        {
            SeatDal           dal    = new SeatDal();
            MovieDal          dal2   = new MovieDal();
            userSeatViewModel mvm2   = new userSeatViewModel();
            SeatViewModel     mvm    = new SeatViewModel();
            List <Seat>       Seatss = new List <Seat>();
            var item = dal2.MOVIES.Where(a => a.ID == id).FirstOrDefault();

            for (int i = 0; i < dal.Seats.ToList().Count(); i++)
            {
                if (dal.Seats.ToList()[i].Hall == item.SALLE && dal.Seats.ToList()[i].date == item.showtime)
                {
                    Seatss.Add(dal.Seats.ToList()[i]);
                }
            }
            mvm2.Seat  = new Seat();
            mvm2.Seats = Seatss;
            return(View(mvm2));
        }
Exemplo n.º 6
0
        public ActionResult ManageSeat(Seat obj)

        {
            if (ModelState.IsValid)
            {
                SeatDal dal    = new SeatDal();
                HallDal Haldal = new HallDal();
                if (Haldal.Halls.Where(s => s.IDHall.Equals(obj.Hall)).Count() > 0)
                {
                    dal.Seats.Add(obj);
                    dal.SaveChanges();
                    return(View("SlideMenu"));
                }
                else
                {
                    return(RedirectToAction("ManageSeat"));
                }
            }
            return(View("SlideMenu"));
        }
Exemplo n.º 7
0
 public ActionResult BookTicket(Tickets obj)
 {
     if (ModelState.IsValid)
     {
         TicketsDal dal = new TicketsDal();
         //MovieDal movieDal = new MovieDal();
         SeatDal seatDal = new SeatDal();
         if (seatDal.Seats.Where(s => s.Number.Equals(obj.SEAT)).Count() > 0)
         {
             //var data = dal.TicketsList.ToList();
             dal.TicketsList.Add(obj);
             dal.SaveChanges();
             return(View("DetailsTickets", obj));
         }
         else
         {
             return(RedirectToAction("BookTicket"));
         }
     }
     return(View("MovieGallery"));
 }
Exemplo n.º 8
0
        public ActionResult Reserve(Seat emp)
        {
            bool status = false;

            if (ModelState.IsValid)
            {
                using (SeatDal dc = new SeatDal())
                {
                    if (emp.IdSeat != null && emp.reserve == false)
                    {
                        //Edit
                        var v = dc.Seats.Where(a => a.IdSeat == emp.IdSeat).FirstOrDefault();
                        if (v != null)
                        {
                            v.reserve = true;
                        }
                    }
                    else
                    {
                        //Save
                        return(View("AlreadyOccuped"));
                    }
                    dc.SaveChanges();

                    status = true;

                    MovieDal dal2 = new MovieDal();
                    var      item = dal2.MOVIES.Where(a => a.SALLE == emp.Hall && a.showtime == emp.date).FirstOrDefault();
                    //return View("BookTicket");

                    return(RedirectToAction("BookTicket", new { idSeat = emp.IdSeat }));
                }
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }