Quote:
I want to be returned to the screen Index with the InsuranceController after the removal operation
...
return RedirectToAction("VehicleInformations", "Index");
The RedirectToAction
method[
^] expects the first parameter to be the action, and the second parameter to be the controller.
You have told your code to redirect to the
VehicleInformations
action on the
Index
controller.
If you want to redirect to the
Index
action in the
Insurance
controller instead, change your code to:
return RedirectToAction("Index", "Insurance");
If the action you're redirecting to is in the same controller as the current action, you can simplify that to:
return RedirectToAction(nameof(Index));
Quote:
The third party insurance part is removed, but the body insurance part is not removed
That's going to depend on your data, and on the values you're posting back to the action. We don't have access to your database, so we can't debug the problem for you.
Set a breakpoint on the first line of the
DeleteConfirmed
method, and step through it to make sure the parameters are being populated correctly, and that the ID refers to a record which exists in your database.