// GET: VehicleType/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(HttpNotFound()); } VehicleType vehicleType = _typeManager.GetById((int)id); EditVehicleTypeViewModel vehicleTypeVM = new EditVehicleTypeViewModel() { Id = vehicleType.Id, TypeName = vehicleType.TypeName }; return(View(vehicleTypeVM)); }
public ActionResult Edit(EditVehicleTypeViewModel vehicleTypeVM) { try { VehicleType vehicleType = new VehicleType() { Id = vehicleTypeVM.Id, TypeName = vehicleTypeVM.TypeName }; _typeManager.Update(vehicleType); return(RedirectToAction("Index")); } catch { return(View()); } }