public ActionResult DeleteConfirmed(int id) { Pilet pilet = db.Pilets.Find(id); db.Pilets.Remove(pilet); db.SaveChanges(); return(RedirectToAction("Index")); }
// Loon uue actioni mis annab kasutajale pileti public ActionResult Osta(int id) { KinoModels Film = db.KinoModels.Find(id); Pilet pilet = new Pilet(); pilet.Film = Film; db.Pilets.Add(pilet); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,PiletiNr")] Pilet pilet) { if (ModelState.IsValid) { db.Entry(pilet).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pilet)); }
public ActionResult Create([Bind(Include = "Id,PiletiNr")] Pilet pilet) { if (ModelState.IsValid) { db.Pilets.Add(pilet); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(pilet)); }
// GET: Pilets/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Pilet pilet = db.Pilets.Find(id); if (pilet == null) { return(HttpNotFound()); } return(View(pilet)); }