I have an action with the same name, one expecting no parameters and the other expecting an ID, when i try navigate through my url i get the following exception.
An unhandled exception occurred while processing the request.
AmbiguousActionException: Multiple actions matched. The following actions matched route data and had all constraints satisfied:
Mailer.Controllers.MailBuilderController.MailBody (Mailer) Mailer.Controllers.MailBuilderController.MailBody (Mailer)
My MailBuilder controller.
//[HttpGet("mailbuilder/MailBody")]
public IActionResult MailBody()
{
Body model = new Body();
return View(model);
}
//[HttpGet("mailbuilder/MailBody/{id}")]
public IActionResult MailBody(int id)
{
Body model = _mailBuilderService.GetBody(id);
return View(model);
}
If i remove the comments above i am able to navigate but i am not able to redirect to action in the below method.
public IActionResult SaveBody(Body model)
{
_mailBuilderService.AddBody(model);
return RedirectToAction("MailBody", model.Id);
}