Ejemplo n.º 1
0
        //// GET: layouts/Details/5
        //public ActionResult Details()
        //{

        //    //if (id == null)
        //    //{
        //    //    return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
        //    //}
        //    ShowSeatLayout layout = cinestar.ShowSeatLayouts.Find(100);
        //    if (layout == null)
        //    {
        //        return HttpNotFound();
        //    }
        //    return View(layout);
        //}



        // GET: layouts/Edit/5
        public ActionResult SelectSeatsView(int showId)
        {
            //if (id == null)
            //{
            //    return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            //}
            ShowSeatLayoutEntity layout = ShowSeatLayoutBL.ReturnSeatLayoutBL(showId);//send show id here

            if (layout == null)
            {
                return(HttpNotFound());
            }
            return(View(layout));
        }
Ejemplo n.º 2
0
        public static ShowSeatLayoutEntity ReturnSeatLayoutDAL(int showId)
        {
            CinestarEntitiesDAL cinestar = new CinestarEntitiesDAL();
            var query = from item in cinestar.ShowSeatLayouts
                        where item.ShowId == showId
                        select item;

            ShowSeatLayout       layout = query.FirstOrDefault();
            ShowSeatLayoutEntity entity = new ShowSeatLayoutEntity();

            entity.LayoutId         = layout.LayoutId;
            entity.ShowId           = layout.ShowId;
            entity.UnavailableSeats = layout.UnavailableSeats;
            return(entity);
        }
Ejemplo n.º 3
0
        public ActionResult SelectSeatsView(ShowSeatLayoutEntity layout, FormCollection form)
        {
            string seatsfromLayout            = form["selectedseats"].ToString();
            string unavailableseatsfromLayout = form["unavailableseats"].ToString();

            string[]   result   = seatsfromLayout.Split('|');
            List <int> seatlist = new List <int>();

            foreach (string item in result)
            {
                int seats;
                if (int.TryParse(item, out seats))
                {
                    if (!seatlist.Contains(Convert.ToInt32(item)))
                    {
                        seatlist.Add(seats);
                    }
                }
            }
            int seatcount = seatlist.Count;
            //add new unavailable seats
            int showId   = Convert.ToInt32(Request.QueryString["showId"]);
            int movieId  = Convert.ToInt32(Request.QueryString["movieId"]);
            int viewerId = Convert.ToInt32(Session["ViewerId"].ToString());

            layout.UnavailableSeats = unavailableseatsfromLayout;
            string selectedseatnos = string.Join(",", seatlist);

            if (ModelState.IsValid)
            {
                bool flag = ShowSeatLayoutBL.UpdateLayoutBL(layout);

                if (flag)
                {
                    string url = string.Format("/Tickets/CreateTicket?noofseats={0}&seatnumbers={1}&viewerid={2}&showid={3}&movieId={4}", seatcount, selectedseatnos, viewerId, showId, movieId);
                    return(Redirect(url));
                }
                else
                {
                    return(View(layout));
                }
            }



            return(View(layout));
        }
Ejemplo n.º 4
0
        public static bool UpdateLayoutDAL(ShowSeatLayoutEntity layout)
        {
            CinestarEntitiesDAL cinestar   = new CinestarEntitiesDAL();
            ShowSeatLayout      seatLayout = new ShowSeatLayout();

            seatLayout.LayoutId              = layout.LayoutId;
            seatLayout.ShowId                = layout.ShowId;
            seatLayout.UnavailableSeats      = layout.UnavailableSeats;
            cinestar.Entry(seatLayout).State = EntityState.Modified;
            int rowsaffected = cinestar.SaveChanges();

            if (rowsaffected > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 5
0
 public static bool UpdateLayoutBL(ShowSeatLayoutEntity layout)
 {
     return(ShowSeatLayoutDAL.UpdateLayoutDAL(layout));
 }
Ejemplo n.º 6
0
        public static ShowSeatLayoutEntity ReturnSeatLayoutBL(int showId)
        {
            ShowSeatLayoutEntity layout = ShowSeatLayoutDAL.ReturnSeatLayoutDAL(showId);

            return(layout);
        }