public IActionResult Edit([Bind("CarID,BrandID,OwnerID,CarRegistrationNumber," + "CarPhoto,CarNumberOfBody,CarNumberOfMotor,CarNumberOfPassport," + "CarReleaseDate,CarRegistrationDate," + "CarLastCheckupDate,CarColor,CarDescription")] Car car) { if (ModelState.IsValid) { try { _db.Update(car); _db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!CarExists(car.CarID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Cars")); } ViewData["BrandID"] = new SelectList(_db.Brands, "BrandID", "BrandName", car.BrandID); ViewData["OwnerID"] = new SelectList(_db.Owners, "OwnerID", "OwnerName", car.OwnerID); return(View(car)); }
public IActionResult Edit([Bind("BrandID,BrandName," + "BrandCompany,BrandCountry,BrandStartDate,BrandEndingDate," + "BrandCharacteristic,BrandCategory,BrandDescription")] Brand brand) { if (ModelState.IsValid) { try { _db.Update(brand); _db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BrandExists(brand.BrandID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Brands")); } return(View(brand)); }
public IActionResult Edit([Bind("OwnerID,OwnerName,OwnerBirthDate,OwnerAddress," + "OwnerPassport,OwnerNumberOfDriverLicense,OwnerLicenseDeliveryDate,OwnerLicenseValidityDate," + "OwnerCategory,OwnerMoreInformation")] Owner owner) { if (ModelState.IsValid) { try { _db.Update(owner); _db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!OwnerExists(owner.OwnerID)) { return(NotFound()); } else { throw; } } return(RedirectToAction("Owners")); } return(View(owner)); }