Can I have a route like ...
routes.MapRoute( "Boundaries-Show", "Boundaries", new { controller = "Boundaries", action = "Show", locationType = UrlParameter.Optional });
Where is the method of action ...
[HttpGet] public ActionResult Show(int? aaa, int? bbb, LocationType locationType) { ... }
and if the person does not provide a value for locationType .., then by default it is equal to LocationType.Unknown .
Is it possible?
Update # 1
I canceled the action method to contain ONE method (only until I get this working). Now it looks like this.
[HttpGet] public ActionResult Show(LocationType locationType = LocationType.Unknown) { .. }
.. and I get this error message ...
The parameter dictionary contains an invalid entry for the 'locationType' parameter for the 'System.Web.Mvc.ActionResult Show (MyProject.Core.LocationType)' method in 'MyProject.Controllers.GeoSpatialController. The dictionary contains a value of type' System.Int32 ', but the parameter requires values โโof type 'MyProject.Core.LocationType. Parameter name: parameters
Does the optional locationType route parameter think it is int32, not a custom Enum ?
Pure.Krome
source share