public async Task <IActionResult> Edit(int id, [Bind("Id,CylindersId,Displacement,DriveId,FuelCost,FuelTypeId,MakeId,Model,TransmissionId,CityMilage,HighwayMilage,VehicleClassId,YearId")] Vehicle vehicle) { if (id != vehicle.id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(vehicle); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VehicleExists(vehicle.id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } ViewData["CylindersId"] = new SelectList(_context.Cylinders, "Id", "Id", vehicle.CylindersId); return(View(vehicle)); }
public async Task <IActionResult> Edit(int id, [Bind("Id,Label")] Drive drive) { if (id != drive.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(drive); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DriveExists(drive.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Index")); } return(View(drive)); }