public ActionResult DeleteConfirmed(int id) { DR_Car dR_Car = db.DR_Car.Find(id); db.DR_Car.Remove(dR_Car); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Type,Catalog,ManufacturedYear,Photo,SeatAmount,Mileage,CarCompany,RentalCompanyId,CarStationId,Price,Feature,Equipment")] DR_Car dR_Car) { if (ModelState.IsValid) { db.Entry(dR_Car).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.RentalCompanyId = new SelectList(db.DR_RentalCompany, "Id", "Name", dR_Car.RentalCompanyId); ViewBag.CarStationId = new SelectList(db.DR_CarStation, "Id", "Address", dR_Car.CarStationId); return(View(dR_Car)); }
// GET: Search/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DR_Car dR_Car = db.DR_Car.Find(id); if (dR_Car == null) { return(HttpNotFound()); } return(View(dR_Car)); }
// GET: Search/Details/5 public ActionResult Details(int?id) { ViewData["UserId"] = User.Identity.GetUserId(); if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DR_Car dR_Car = db.DR_Car.Find(id); if (dR_Car == null) { return(HttpNotFound()); } return(View(dR_Car)); }
// GET: Search/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } DR_Car dR_Car = db.DR_Car.Find(id); if (dR_Car == null) { return(HttpNotFound()); } ViewBag.RentalCompanyId = new SelectList(db.DR_RentalCompany, "Id", "Name", dR_Car.RentalCompanyId); ViewBag.CarStationId = new SelectList(db.DR_CarStation, "Id", "Address", dR_Car.CarStationId); return(View(dR_Car)); }