Ejemplo n.º 1
0
        public async Task <IActionResult> Putseats(int id, seats seats)
        {
            if (id != seats.seatsId)
            {
                return(BadRequest());
            }

            _context.Entry(seats).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!seatsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <seats> > Postseats(seats seats)
        {
            _context.seats.Add(seats);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("Getseats", new { id = seats.seatsId }, seats));
        }
Ejemplo n.º 3
0
        public ActionResult check()
        {
            if (Session["userid"] == null)
            {
                return(RedirectToAction("login1", "account1"));
            }
            else
            {
                con.ConnectionString = "Data Source=LAPTOP-3OSSUTQ9;Initial Catalog=AppDB;Integrated Security=True;MultipleActiveResultSets=True;Application Name=EntityFramework";
                seats s = new seats();
                con.Open();
                com.Connection  = con;
                com.CommandText = "Select pseats,eseats from theatre where theatreid=" + Session["theatre"];
                dr = com.ExecuteReader();
                while (dr.Read())
                {
                    s.exec = Int32.Parse(dr["eseats"].ToString());
                    s.reg  = Int32.Parse(dr["pseats"].ToString());
                }
                con.Close();
                con.Open();
                com.Connection  = con;
                com.CommandText = "Select seat from bookings where theatreid=" + Session["theatre"] + " and timeid=" + Session["time"] + " and movieid=" + Session["movieid"];
                dr = com.ExecuteReader();
                List <int> arr = new List <int>();
                while (dr.Read())
                {
                    arr.Add(Int32.Parse(dr["seat"].ToString()));
                }
                ViewBag.booked  = arr;
                ViewBag.exec    = s.exec;
                ViewBag.reg     = s.reg;
                ViewBag.time    = Session["time"];
                ViewBag.theatre = Session["theatre"];

                return(View());
            }
        }