Ejemplo n.º 1
0
 public ActionResult Edit([Bind(Include = "EventID,Name,StartDateTime,EndTime,ImageURL,VideoURL,Description")] Event @event)
 {
     if (ModelState.IsValid)
     {
         db.Entry(@event).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(@event));
 }
Ejemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "SeatID,RowNo,SeatNo,SeatType,ShowID,Status")] Seat seat)
 {
     if (ModelState.IsValid)
     {
         db.Entry(seat).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ShowID = new SelectList(db.Shows, "ShowID", "ShowID", seat.ShowID);
     return(View(seat));
 }
Ejemplo n.º 3
0
        //[HttpPost]
        //[ValidateAntiForgeryToken]
        //public ActionResult Book([Bind(Include = "SeatID,RowNo,SeatNo,SeatType,ShowID,Status")] Seat seat)
        //{
        //    if (ModelState.IsValid)
        //    {
        //        db.Entry(seat).State = EntityState.Modified;
        //        db.SaveChanges();
        //        return RedirectToAction("Book");
        //    }
        //    return RedirectToAction("Book");
        //}


        public ActionResult BookSeat(int showID, int seatID)
        {
            Seat seat = db.Seats.Find(seatID);

            if (seat.Status == SeatStatus.Available)
            {
                seat.Status = SeatStatus.Hold;
            }
            else if (seat.Status == SeatStatus.Hold)
            {
                seat.Status = SeatStatus.Available;
            }

            if (ModelState.IsValid)
            {
                db.Entry(seat).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Book", new { id = showID }));
            }

            return(RedirectToAction("Book", new { id = showID }));
        }