コード例 #1
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"));
        }
コード例 #2
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 }
            });
        }