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()); }
public async Task <ActionResult <seats> > Postseats(seats seats) { _context.seats.Add(seats); await _context.SaveChangesAsync(); return(CreatedAtAction("Getseats", new { id = seats.seatsId }, seats)); }
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()); } }