I have a controller that is accepting 3 values from a submitted form, this works fine.
What I need to do now, however is enable a generated link to post the same data to the controller.
The controller looks like this:
[HttpPost]
public ActionResult Customer(string lastName, string postCode, string quoteRef)
{
// Using passed parameters here
}
I am aware routing allows prettier URL's but in this case I need the form to be able to accept the three values either through the submitted form or by the following hyperlink format:
path.to.url/Home/Customer?lastName={1}&postcode={2}"eRef={3}
I have looked into routing but I can't find anything that will allow me to achieve this outcome.
My routes are currently set up as the following:
routes.MapRoute(
"Customer",
"{controller}/{action}/{id}/{lastName}/{postCode}/{quoteRef}",
new {controller = "Home", action = "Customer", id = ""}
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);