public IActionResult DeleteConfirmed(int?id) { VehicleType vehicleType = _vehicleTypeRepository.FindVehiecleById(v => v.Id == id).FirstOrDefault(); try { _vehicleTypeRepository.DeleteEntity(vehicleType); _vehicleTypeRepository.Commit(); } catch (DbUpdateException ex) { ModelState.AddModelError("Deleting vehicle type", "Failed editing owner data. " + ex.Message); } return(RedirectToAction("Index")); }