public ActionResult DeleteConfirmed(int id) { myTicket myTicket = db.myTickets.Find(id); db.myTickets.Remove(myTicket); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Code,Date,Title,Theater,Actors,Seats,Site,Price")] myTicket myTicket) { if (ModelState.IsValid) { db.Entry(myTicket).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(myTicket)); }
public ActionResult Create([Bind(Include = "Id,Code,Date,Title,Theater,Actors,Seats,Site,Price")] myTicket myTicket) { if (ModelState.IsValid) { db.myTickets.Add(myTicket); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(myTicket)); }
public void ShowTickets() { int i; for (i = 0; i < dt.Rows.Count; i++) { myTicket ticket = new myTicket(); ticket.id = Convert.ToInt32(dt.Rows[i]["ticket_id"]); ticket.title = Convert.ToString(dt.Rows[i]["ticket_title"]); listBox1.Items.Add(ticket); } }
// GET: myTickets/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } myTicket myTicket = db.myTickets.Find(id); if (myTicket == null) { return(HttpNotFound()); } return(View(myTicket)); }