public ActionResult DeleteConfirmed(int id) { RentRecord rentRecord = db.RentRecords.Find(id); db.RentRecords.Remove(rentRecord); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "RentalID,MovieID,CustomerID,RentalDate,DueDate,ReturnDate")] RentRecord rentRecord) { if (ModelState.IsValid) { db.Entry(rentRecord).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "CustomerName", rentRecord.CustomerID); ViewBag.MovieID = new SelectList(db.Movies, "MovieID", "MovieName", rentRecord.MovieID); return(View(rentRecord)); }
// GET: RentRecords/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RentRecord rentRecord = db.RentRecords.Find(id); if (rentRecord == null) { return(HttpNotFound()); } return(View(rentRecord)); }
// GET: RentRecords/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } RentRecord rentRecord = db.RentRecords.Find(id); if (rentRecord == null) { return(HttpNotFound()); } ViewBag.CustomerID = new SelectList(db.Customers, "CustomerID", "CustomerName", rentRecord.CustomerID); ViewBag.MovieID = new SelectList(db.Movies, "MovieID", "MovieName", rentRecord.MovieID); return(View(rentRecord)); }