public ActionResult Edit([Bind(Include = "VehicleTypeId,VehicleTypeName,CreateDate,EditDate")] VehicleType vehicleType) { try { if (ModelState.IsValid) { db.Entry(vehicleType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(vehicleType)); } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } return(View("Error", new HandleErrorInfo(ex, "VehicleTypesController", "Edit"))); } }
public ActionResult Edit([Bind(Include = "ModelId,EngineSize,NumberOfDoors,Colour,VehicleTypeId,CreateDate,EditDate")] Model model) { try { if (ModelState.IsValid) { db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.VehicleTypeId = new SelectList(db.VehicleTypes, "VehicleTypeId", "VehicleTypeName", model.VehicleTypeId); return(View(model)); } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } return(View("Error", new HandleErrorInfo(ex, "ModelsController", "Edit"))); } }
public ActionResult Edit([Bind(Include = "VehicleId,MakeId,ModelId,Year,Price,Cost,SoldDate,isSold,CreateDate,EditDate")] Vehicle vehicle) { try { if (ModelState.IsValid) { db.Entry(vehicle).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.MakeId = new SelectList(db.Makes, "MakeId", "Name", vehicle.MakeId); ViewBag.ModelId = new SelectList(db.Models, "ModelId", "ModelId", vehicle.ModelId); return(View(vehicle)); } catch (Exception ex) { while (ex.InnerException != null) { ex = ex.InnerException; } return(View("Error", new HandleErrorInfo(ex, "VehiclesController", "Edit"))); } }